MySQL Forums
Forum List  »  Newbie

JDBC connection problem when using UCS2
Posted by: Wei Bai
Date: September 02, 2004 12:39AM

hi, all

I've some questions regarding using UCS2 in Mysql,
my OS: Fedora Core release 1 Linux,
mysql: Ver 14.6 Distrib 4.1.4-gamma, for pc-linux (i686)
JDBC: mysql-connector-java-3.0.14-production-bin.jar

I congire the character set to ucs2 in /etc/my.cnf
[mysqld]
default-character-set=ucs2

It works fine when I insert or query by mysql client, but I get a
exception when I want to make a connection with JDBC:

Connection con = DriverManager.getConnection("jdbc:mysql://localhost/db?user=root");


java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??' at line 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1977)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1163)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1272)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1218)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2233)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2193)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2174)
at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2702)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3184)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1788)
at com.mysql.jdbc.Connection.<init>(Connection.java:440)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:400)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at sql.main(sql.java:13)


Could anyone help to solve this problem?
Thanks very much.


Options: ReplyQuote


Subject
Written By
Posted
JDBC connection problem when using UCS2
September 02, 2004 12:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.