Bug #5031 Unknown system variable 'character_set_results'
Submitted: 13 Aug 2004 12:59 Modified: 13 Aug 2004 22:56
Reporter: Jehanzeb Pathan Email Updates:
Status: Won't fix Impact on me:
Category:Connector / J Severity:S3 (Non-critical)
Version:3.0.14-production OS:Windows (Windows)
Assigned to: Dean Ellis CPU Architecture:Any

[13 Aug 2004 12:59] Jehanzeb Pathan

We have been developing using JConnector 3.0.10 and MySQL 4.1.0 alpha. We were experiencing an error from the MySQL server where it would send back an error saying that a table being queried does not exist, but as we would send a select statement to the same table using a C-based MySQL client (which would of course be successful) and would re-run the JConnector code, it would find the table successfully for the rest of the day. The error kept on re-occurring after MySQL would restart.

I decided to use JConnector 3.0.14. I get the following error:

java.sql.SQLException: General error,  message from server: "Unknown system variable 'character_set_results'"
	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)

I have found out that that "Show variables like 'character%' " only shows 2 variables and thus the character_set_results variable is not defined by default in MySQL 4.1.0 alpha. We will try to work around it by setting the variable by force.

Though I would report it just in case anyway.

Thank you for the great work you all have done.

How to repeat:

Use MySQL 4.1.0 alpha with JConnector 3.0.14 and run a normal connection in Java.

Suggested fix:

Fix JConnector to not ask for the variable character_set_results for servers before 4.1.0
[13 Aug 2004 22:52] Matthew Lord
Dear Sir,

Thank you for your bug report!  You should be using connector/j 3.1.3-beta when connecting to 
4.1.x.  4.0 clients, 4.0 connectors (3.0.x for connector/j) do not know about all the new client 
related options in 4.1.

I would also *strongly* recommend upgarding to mysql 4.1.3-beta ASAP as there have been 
some incompatible changes made since 4.1.0 and many many bug fixes.  4.1.3 now has all 
features implemented as they will be in the production version and is only undergoing testing and 

Best Regards
[13 Aug 2004 22:56] Dean Ellis
There have been a large number of changes (new features, bug fixes, etc) to the 4.1 tree since 4.1.0 was released.  If you look at the subsequent changelogs you will most likely want to upgrade to a current 4.1 release (and have this problem go away).

Basically, no one should be running 4.1.0 anymore, so there is not much reason to change Connector/J to support an old, "very alpha" release of the server.