Friday, February 18, 2011

Oracle JDBC Connection String Nonsense

After spending several hours trying to sort out the cause of a cryptic message from Oracle's JDBC driver I finally tried something that worked, but the cause, as is often the case with Oracle error message, was completely absent from the error message text. I'm posting this because it was also completely absent from any Google results.

I had a DataSource set up with a connection string as follows:

jdbc:oracle:thin:@//10.0.50.1:1521/mysid

Any attempt to open a connection using that DataSource resulted in the following, completely useless error message:

java.sql.SQLException: Io exception: Got minus one from a read call

Changing it to a slightly different JDBC URL string format made it work.

jdbc:oracle:thin:@10.0.50.1:1521:mysid

The only differences are that // just following the @ has been removed, and the "sid" is delimited at the end by : instead of /

I hope having this matched up with the error message gets someone past all the noise about the number of processes or the number of connections in the listener. At least in my case, that stuff had absolutely nothing to do with it.

No comments: