| Author |
Connecting with MySql
|
abhijeet srivastava
Greenhorn
Joined: Aug 22, 2006
Posts: 26
|
|
Hi all! I am trying to connect MySql using connector mysql-connector-java-3.0.17-ga-bin.jar. Driver is loaded but it is not getting connected. Though in Windows it works fine but give problem in linux fedora 6. I am using connection string jdbc:mysql://localhost:3306/test with username and password. It shows following error- SQLException:java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.SocketException: java.net.ConnectException: Connection refused ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.net.ConnectException: Connection refused STACKTRACE: java.net.SocketException: java.net.ConnectException: Connection refused at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:143) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:225) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1805) at com.mysql.jdbc.Connection.<init>(Connection.java:452) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:171) at Check.main(Check.java:27) ** END NESTED EXCEPTION ** Whats wrong?
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Abhijeet, From the connection refused message, I suspect a firewall setting or bad password. Can you connect at the command line?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
abhijeet srivastava
Greenhorn
Joined: Aug 22, 2006
Posts: 26
|
|
|
There is no problem in connnection on command line. I have also disabled firewall. still same problem.
|
 |
 |
|
|
subject: Connecting with MySql
|
|
|