Re: [LONG] Connector/J SQLState 0S100 usage/meaning
Mark Matthews wrote : Gilles Magnier wrote: [snip] I think having identical error code for unsuported exception and bad parameter error is a bit confusing, for me at least ... Thanks for any help, These definitely look like typos. After the holidays, I will look into a fix for these using constants in SQLError so that typos will no longer be a problem. Thanks, i've an other question : it's looks like there is an other possible problem in SQLStates error code usage in Connector/J. Error code "08003" witch means "using a closed connection" according to both sqlstate.h and SQLError.java is used in Connection.java (function setAutoCommit line 576) when transaction is not supported but i don't know if it's the good error code to use or if not wich one shoud be used. throw new SQLException("MySQL Versions Older than 3.23.15 " + "do not support transactions", "08003"); Could you take a look on that while fixing typos ? Again thanks a lot, Gilles. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: [LONG] Connector/J SQLState 0S100 usage/meaning
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gilles Magnier wrote: > Hi, > > i'm trying to write a java application which handle SQLException > correctly. > > To achieve that i use declarations found in sqlstate.h and SQLError.java. > > Note that if someone have a good URL about SQLState error codes > i'm really interested. > > then i've greped Connector/J source for SQLException throwing. This > operation show me some "problems". > > Connector/j throws SQLExeption with an SQLState value of "0S100" which > is not used/declared in SQLError.java nor in sqlstate.h. > > Is this a correct SQLState or a typo ? > > It's first used for unicode support error, this may be correct but > should anyway be declared somewhere: > > (Note that lines references are for connector/J 3.0.8-stable source code) > > In Connection.java near line 2049 function checkServerEncoding : > > // > // Attempt to use the encoding, and bail out if it > // can't be used > // > [snip] > } catch (UnsupportedEncodingException UE) { >throw new SQLException( >"The driver can not map the character encoding '" >+ this.encoding + "' that your server is using " >+ "to a character encoding your JVM understands. You " >+ "can specify this mapping manually by adding \"useUnicode=true\" " >+ "as well as \"characterEncoding=[an_encoding_your_jvm_understands]\" " >+ "to your JDBC URL.", "0S100"); > } > > But it's used elsewhere with really different meaning : > > In Connection.java near line 2217 function InitializeDriverProperties. > This fuction checks that URL parameters are valid if not i think it > shoud use sqlqtate 01S00 as declared in SQLError.java line 45 : > sqlStateMessages.put("01S00", "Invalid connection string attribute"); > but it use 0S100 : > > throw new SQLException("socketTimeout can not " + "be < 0", > "0S100"); > > this looks like a typo in SQLError.java or in Connection.java. > In the same function for other parameters the same problem appears : > lines 2224, 2236, 2248 and 2267. > > Error code 0S100 is used again for Unsupported encoding > (same function) line 2296. > > And again line 1778 in ResultSet.java function getString(int) for > unsupported encoding too. > > I think having identical error code for unsuported exception and bad > parameter error is a bit confusing, for me at least ... > > > Thanks for any help, These definitely look like typos. After the holidays, I will look into a fix for these using constants in SQLError so that typos will no longer be a problem. -Mark - -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 557 2388 www.mysql.com Are you MySQL Certified? http://www.mysql.com/certification/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQE/57eUtvXNTca6JD8RApJBAKCo5uV88ZhznDro25Qmm3JgczimNwCgjmXo QYP3EARQXWiQ3oPFUbQoSMM= =5boi -END PGP SIGNATURE- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
[LONG] Connector/J SQLState 0S100 usage/meaning
Hi, i'm trying to write a java application which handle SQLException correctly. To achieve that i use declarations found in sqlstate.h and SQLError.java. Note that if someone have a good URL about SQLState error codes i'm really interested. then i've greped Connector/J source for SQLException throwing. This operation show me some "problems". Connector/j throws SQLExeption with an SQLState value of "0S100" which is not used/declared in SQLError.java nor in sqlstate.h. Is this a correct SQLState or a typo ? It's first used for unicode support error, this may be correct but should anyway be declared somewhere: (Note that lines references are for connector/J 3.0.8-stable source code) In Connection.java near line 2049 function checkServerEncoding : // // Attempt to use the encoding, and bail out if it // can't be used // [snip] } catch (UnsupportedEncodingException UE) { throw new SQLException( "The driver can not map the character encoding '" + this.encoding + "' that your server is using " + "to a character encoding your JVM understands. You " + "can specify this mapping manually by adding \"useUnicode=true\" " + "as well as \"characterEncoding=[an_encoding_your_jvm_understands]\" " + "to your JDBC URL.", "0S100"); } But it's used elsewhere with really different meaning : In Connection.java near line 2217 function InitializeDriverProperties. This fuction checks that URL parameters are valid if not i think it shoud use sqlqtate 01S00 as declared in SQLError.java line 45 : sqlStateMessages.put("01S00", "Invalid connection string attribute"); but it use 0S100 : throw new SQLException("socketTimeout can not " + "be < 0", "0S100"); this looks like a typo in SQLError.java or in Connection.java. In the same function for other parameters the same problem appears : lines 2224, 2236, 2248 and 2267. Error code 0S100 is used again for Unsupported encoding (same function) line 2296. And again line 1778 in ResultSet.java function getString(int) for unsupported encoding too. I think having identical error code for unsuported exception and bad parameter error is a bit confusing, for me at least ... Thanks for any help, Gilles. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]