#709 NullPointerException in JtdsConnection.determineServerCharset

v1.3
open
nobody
None
1
6 days ago
2013-07-26
sqweek
No

Hi guys, thanks for Jtds! It's been working great, though I hit this strange error:

java.lang.NullPointerException
    at net.sourceforge.jtds.jdbc.JtdsConnection.determineServerCharset(JtdsConnection.java:1492)
    at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:402)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:183)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.dugeo.util.db.SQLConnectionSettings.connect(SQLConnectionSettings.java:184)
    ...

this is against 1.3.0, so JtdsConnection.java:1492 is this line:

            if (databaseProductVersion.indexOf("6.5") >= 0) {

the obvious conclusion is that databaseProductVersion == null. The only way I can see for that to happen is if the login succeeds but no TDS_LOGINACK_TOKEN is recieved... I'm completely new to the TDS protocol, but that doesn't sound like a sensible scenario.

Unfortunately the SQL server in question is outside my control so there are a lot of unknowns there, but it is not a consistent error - the user has reported success in the past.

On the client side, the only properties I set in the JTDS connection string are 'instance', 'domain', 'user', 'password' - I don't touch 'charset' or 'TDS'.

Any other ideas, or information that would be useful? This isn't a high priority, but it would be nice to know what is going on :)

Discussion