Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

support Chinese Charater?

1 view
Skip to first unread message

April

unread,
Dec 29, 1999, 3:00:00 AM12/29/99
to
I'm using sun.jdbc.odbc.JdbcOdbcDriver as the JDBC driver
Does it support Chinese Charater?
I face problem when I have such query:
ResultSet rs = stmt.executeQuery("SELECT ShopName, Tel, Fax, Address,
District FROM Shops WHERE ShopName = \'<Chinese Charaters>\'");

but when the <Chinese Charaters> replace by some English charaters, it
has no problem..

the error messages are:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver]
Syntax error
in string in query expression 'ShopName = '<the Chinese Charaters>'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:4089)

at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:4246)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:1172)
at
sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:206)
at
sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:131)

at jdbctest.main(jdbctest.java, Compiled Code)

what can I do if my data is in Chinese.

Thanks

April Ng

squirrel

unread,
Jan 6, 2000, 3:00:00 AM1/6/00
to
Try using a prepared statement for the query; use ? in the query instead of
the string itself and use setString() to set the value you are looking for.


April <eg_n...@susis.ust.hk> wrote in message
news:3869FF73...@susis.ust.hk...

chu_...@my-deja.com

unread,
Jan 20, 2000, 3:00:00 AM1/20/00
to
Actually, I'm not so familiar with java, jdbc,
odbc. I also face the SAME problem: cannot insert
an entity with chinese character into my database
through jdbc.odbc driver. But I tried to execute
the same sql statement in my database, it does
work. What I've done is replace
the "sun.jdbc.odbc.JdbcOdbcDriver"
by another driver "COM.ibm.db2.jdbc.app.DB2Driver"
(as I'm using db2 database server). Then the
whole program can be execute correctly.

Although it is not a good solution, I hope it can
help a bit.


In article <3869FF73...@susis.ust.hk>,

Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages