[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Have prob to connect to MySQL



Hi,

Sorry if this is not the right forum to post this...
I have problem with my java code to connect to mysql, with this url
jdbc:mysql://localhost:3306/<dbName> (using the official mysql java
driver). The same java code can connect in my xp installation. The
error can be found at the end of this msg. First i suspect it cannot
create a socket to connect, maybe i screwed up my java installation. I
tried using commons-httpclients from jakarta.apache.org to access to
http://localhost:8080 (with Tomcat running), it works. So it's not
socket creation problem. Now i suspect the protocol jdbc:mysql. We can
see "Connection refused" in the error msg. Any idea? Is the protocol
blocked? But if it's blocked, how can the mysql-client in my
installation connect? How to check what is blocked or not? Many thx for
the advices.


- Rony -





** BEGIN NESTED EXCEPTION **

java.net.ConnectException
MESSAGE: Connection refused

STACKTRACE:

java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
        at java.net.Socket.connect(Socket.java:507)
        at java.net.Socket.connect(Socket.java:457)
        at java.net.Socket.<init>(Socket.java:365)
        at java.net.Socket.<init>(Socket.java:178)
        at
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:121)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:220)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1768)
        at com.mysql.jdbc.Connection.<init>(Connection.java:440)
        at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:400)
        at java.sql.DriverManager.getConnection(DriverManager.java:525)
        at java.sql.DriverManager.getConnection(DriverManager.java:171)
        at Test.test(Test.java:12)
        at Test.main(Test.java:28)


** END NESTED EXCEPTION **


        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1836)
        at com.mysql.jdbc.Connection.<init>(Connection.java:440)
        at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:400)
        at java.sql.DriverManager.getConnection(DriverManager.java:525)
        at java.sql.DriverManager.getConnection(DriverManager.java:171)
        at Test.test(Test.java:12)
        at Test.main(Test.java:28)



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 



Reply to: