-----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]

Reply via email to