Please refer to Stumped SQL Exception for JDBC
I have a similar error (listed below) when run as a non-root debian user. But this error does not occur if the java application is run as a root user in debian.
The application is configured to connect to mysql as a root user.
I rebooted the system after adding the following entries in my.cnf as advised in the referred question. But the same error occurs.
character_set_server=utf8 collation_server=utf8_general_ci
Please help.
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:1026) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536) at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1751) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3425) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2045) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:718) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:298) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282) at java.sql.DriverManager.getConnection(libgcj.so.10) at java.sql.DriverManager.getConnection(libgcj.so.10) at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:65) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:840) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96) at edu.amrita.jdbc.connectionpool.bundle.DBConnectionPoolImpl.getConnection(DBConnectionPoolImpl.java:95) at edu.amrita.devicetalk.protocol.aesccmp.DatabaseInterface.getRegisteredDevices(DatabaseInterface.java:116)
Make sure that non-root uses Oracle Java (
sun-java6-jdkandsun-java6-jrepackages from non-free) using update-alternatives command (as root):Choose appropriate number (here 2). After that there should be: