By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,854 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,854 IT Pros & Developers. It's quick & easy.

jdbc createConnection(String url) throws exception

P: 2
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you can.

I'm using Eclipse 3.2.2 and I have installed mysql-connector-java-5.0.6-bin.jar. I am trying to connect to SQL Enterprise Manager version 8.0 innstall on a Windows 2003 Server Enterprise Edition.

I have been able to successfully test connectivity using Windows ODBC Data Sources so I know the connection parameters are correct. The test app throws an exception on getConnection;

------------------
String url = "jdbc:mysql://168.177.1.89:1433/PSS?user=test&password=test1&useReadAheadInput=fal se&useUnbufferedInput=true");
String driverClass = "org.gjt.mm.mysql.Driver";

Class.forName(driverClass);
Connection connection = DriverManager.getConnection(url);
-------------------
Here is the entire exception:
SQLException: 0:Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

com.mysql.jdbc.CommunicationsException
MESSAGE: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Connection reset

STACKTRACE:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1953 )
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:558 )
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:10 29)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2749)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.utah.traffic.factory.MysqlConnectionFactory.cr eateConnection(MysqlConnectionFactory.java:13)
at org.utah.traffic.dlConv.test.DlTest.main(DlTest.ja va:54)


** END NESTED EXCEPTION **



Last packet sent to the server was 16 ms ago.

STACKTRACE:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Connection reset

STACKTRACE:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1953 )
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:558 )
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:10 29)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2749)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.utah.traffic.factory.MysqlConnectionFactory.cr eateConnection(MysqlConnectionFactory.java:13)
at org.utah.traffic.dlConv.test.DlTest.main(DlTest.ja va:54)


** END NESTED EXCEPTION **



Last packet sent to the server was 16 ms ago.
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:626 )
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:10 29)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2749)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.utah.traffic.factory.MysqlConnectionFactory.cr eateConnection(MysqlConnectionFactory.java:13)
at org.utah.traffic.dlConv.test.DlTest.main(DlTest.ja va:54)


** END NESTED EXCEPTION **



Last packet sent to the server was 0 ms ago.:Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

com.mysql.jdbc.CommunicationsException
MESSAGE: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Connection reset

STACKTRACE:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1953 )
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:558 )
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:10 29)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2749)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.utah.traffic.factory.MysqlConnectionFactory.cr eateConnection(MysqlConnectionFactory.java:13)
at org.utah.traffic.dlConv.test.DlTest.main(DlTest.ja va:54)


** END NESTED EXCEPTION **



Last packet sent to the server was 16 ms ago.

STACKTRACE:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Connection reset

STACKTRACE:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1953 )
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:558 )
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:10 29)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2749)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.utah.traffic.factory.MysqlConnectionFactory.cr eateConnection(MysqlConnectionFactory.java:13)
at org.utah.traffic.dlConv.test.DlTest.main(DlTest.ja va:54)


** END NESTED EXCEPTION **



Last packet sent to the server was 16 ms ago.
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:626 )
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:10 29)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2749)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.utah.traffic.factory.MysqlConnectionFactory.cr eateConnection(MysqlConnectionFactory.java:13)
at org.utah.traffic.dlConv.test.DlTest.main(DlTest.ja va:54)


** END NESTED EXCEPTION **



Last packet sent to the server was 0 ms ago.:[Ljava.lang.StackTraceElement;@1cb25f1
Jun 4 '07 #1
Share this Question
Share on Google+
2 Replies


P: 2
I was trying to connect to mssql server with mysql drivers. Works great with the correct drivers.
Jun 5 '07 #2

Motoma
Expert 2.5K+
P: 3,235
I was trying to connect to mssql server with mysql drivers. Works great with the correct drivers.
Thanks for posting the solution to your problem for others to see!
Jun 5 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.