3

可能的重复:
JDBC 的 Stumped SQL 异常

我正在使用 Linux 服务器。但是当我在 mysql 服务器中建立连接时,我得到了这种类型的异常。

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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.SQLError.createSQLException(SQLError.java:1027)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3361)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3295)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1852)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1975)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2470)
at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1669)
at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3336)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1979)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:287)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
at java.sql.DriverManager.getConnection(libgcj.so.10)
at java.sql.DriverManager.getConnection(libgcj.so.10)
at testthread.ConnectionFactory.getConnection(ConnectionFactory.java:28)
at testthread.ConnectionFactory.main(ConnectionFactory.java:39)
4

2 回答 2

0

您的 Java 版本或字符集配置有问题,如:Stumped SQL Exception for JDBC

于 2012-07-17T07:55:23.020 回答
0

您是否尝试将您的网址设置为"jdbc:mysql//" + user + "@" + password + ":" + server + "/" + databasename

于 2012-07-17T08:01:14.173 回答