Hi All!
I saw a letter with the question about using a national charsets last month.
>SAPDB & JDBC & National CharacterSet
>Dmitry Bukeev Dmitry Bukeev" <[EMAIL PROTECTED]
>Wed, 16 Jan 2002 13:21:10 +0300
>Previous message: Sorting with national characters
>Next message: Cache invalidation / Message queues
>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>
>
>
>Hi all, I have some question. JDBC driver couldn't correct transfer string
>with national characters to SAPDB when I use Statement.execute(). Same
>problem with using DbVisualizer. Please, help me.
>
>Problem description
>--------------------------------------------
>Statement stmt;
>....
>....
>stmt.execute ("Create table UnicodeTest ("
> + "ucol char (20) unicode,"
> + "ucol2 char (20) unicode,"
> + "ulongcol LONG UNICODE)");
>....
>....
>stmt.execute("insert into UnicodeTest (ucol, ulongcol) values
>('SOMESTRING','@@@@')");
>ResultSet cursor = stmt.executeQuery("select ucol, ulongcol from
>UnicodeTest");
>while (cursor.next ()) {
> for (int i = 1; i <= 2; ++i) {
> String fetchValue = cursor.getString (i);
> System.out.println ("cursor.getString (" + i + "): '" +
fetchValue
>+ "'"); file://#print
> }
>}
>-------------------------------------
>When 'SOMESTRING' is string in Latin-1 codepage, that's all right.
>But when i insert instead of 'SOMESTRING' string with national codepage as
>russian Windows-1251, i have trouble.
>select return string as '???????'.
>For PrepareStatement it is OK.
>-------------------------------------------------
>I use SAPDB 7.3.0 , JDBC driver 7.3.0-0.19a, JDK 1.3.1 on Windows 2000
>Professional with Russian locale.
>Dbase for testing I was create with unicode support with next parameters :
> param_put _UNICODE YES
> param_put DEFAULT_CODE UNICODE
>I test JDBC with and without parameter unicode=true.
>
>Dmitry Bukeev
I've patched JDBC driver for SAP DB. Now it works properly with national
charsets not only in UNICODE mode.
Now you can set encoding to work with database.
For example:
Properties prop = new Properties();
prop.put("user", "user");
prop.put("password", "password");
prop.put("charset", "Cp1251"); // or any another; for example "koi-8r"
Connection con = DriverManager.getConnection("jdbc:sapdb:DATABASE", prop);
or
DriverSapDB.setCharcterEncoding("Cp1251");
Connection con = DriverManager.getConnection("jdbc:sapdb://HOST/DATABASE",
"user", "password");
Default encoding is "ISO8859_1" as before.
I'll send the sources to all who really need it.
Will developers of SAP DB include this patch in next official release?
JDBC drivers for Interbase, mySQL, JDBC-ODBC bridge work similarly.
Cincerely. Yevgeny Konovalov
[EMAIL PROTECTED]
----
http://www.rambler.ru
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general