RE: dblocale
Posted in 2003
Hi,
if anyone is interested the trick was to use the codeset number instead of
the
codeset name. Eg. this works:
UPDATE systables SET site = "hu_hu.912" WHERE tabid=90 OR tabid=91
Cheers,
Gyula
> Hi,
> orginally the database locale was set to hu_hu.ISO8859-2.
> This works with ESQL/C, ODBC, etc. However the setting fails
> with JDBC - the latter seems to accept only the hu_hu.8859-2
> or hu_hu.912 syntax for the ISO Latin-2 codepage (see the
> sample Java program below).
>
> Since the problem is only with the syntax, we tried to update
> the locale information directly in the system catalogue. Both
> the Informix Guide to GLS Functionality (see 1-26), and
> Informix Guide to SQL Reference (see 1-47) says that locale
> information is stored in the systables table, in the
> GL_COLLATE and GL_CTYPE records. Thus we updated the system
> catalogoue:
>
> UPDATE systables set site = "hu_hu.8859-2" WHERE tabid=90
> OR tabid=91>
> However, after updating the syscatalogue, the JDBC driver
> still results in the same error message:
>
> Encoding or code set not supported.
> java.sql.SQLException: Encoding or code set not supported.
>
>
> Is there another place (besides the systables) where the the
> database stores the locale information? Is there a way to
> change the database locale without migrating it (eg. without
> the export-drop-import procedure)?
>
>
> Thanks for any help in advance.
>
> Regards,
> Gyula
>
>
> informixtest2.java
> ------------------
> import java.sql.*;
>
> public class informixtest2
> {
>
> public informixtest2(String host, String port, String
> server, String db, String ctlocale, String dblocale)
> {
> try
> {
> String driver = "com.informix.jdbc.IfxDriver";
> Class.forName(driver);
>
> String connectString =
> "jdbc:informix-sqli://"+host+":"+port+"/"+db+":INFORMIXSERVER=
> "+server+";CLIENT_LOCALE="+ctlocale+";DB_LOCALE="+dblocale;
>
> System.out.println();
> System.out.println("url:");
> System.out.println(connectString);
>
> String user = "informix";
> String password = "informix";
> Connection conn =
> DriverManager.getConnection(connectString,user,password);
>
> System.out.println();
> System.out.println("tables: ");
> ResultSet rs =
> conn.createStatement().executeQuery("SELECT * FROM systables");
> while( rs.next() ){
> String name =
> rs.getString("owner").trim()+"."+rs.getString("tabname").trim();
> String created = rs.getString("created");
>
> System.out.println(name + "\\t[created at
> "+created+"]");
> }
> }
> catch (Exception e){
> System.out.println(e.getMessage());
> e.printStackTrace();
>
> }
> }
>
> public static void main(String args[]) throws Exception{
> if (args.length<6) usage();
> informixtest2 x = new informixtest2(args[0], args[1],
> args[2], args[3],args[4], args[5]);
> }
> private static void usage(){
> System.out.println();
> System.out.println("usage: java informixtest2 host port
> server database clientlocale dblocale");
> System.exit(-1);
> }
> }
>