MySQL JDBC Fails to connect but MySQL Query Browser works....

MySQL JDBC Fails to connect but MySQL Query Browser works....

Post by RunZicoRu » Tue, 17 May 2005 05:37:46



HI;

I have MySQL running on a mandrake Linux box. I installed MySQL
Query Browser client. I added a user to my MySQL called zico. I was
able to connect from MySQL Query Browser to the database and run a
query. When I try to connnect to the database using "java ExecuteSQL -d
org.gjt.mm.mysql.Driver -p elf -u zico jdbc:mysql://192.168.2.3/test",
it doesn't work. Does jdbc (Connector J)has a verbose debugging
options? my /etc/my.cnf file is empty and mysqld didn't start with the
skip-networking option. I can see everything fine with MySql Query
Browser. How come this is not working? Thanks for any help.


STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection
refused: connect

at
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
va:151)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1774)
at com.mysql.jdbc.Connection.<init>(Connection.java:437)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:268)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ExecuteSQL.main(ExecuteSQL.java:47)


** END NESTED EXCEPTION **
 
 
 

MySQL JDBC Fails to connect but MySQL Query Browser works....

Post by Mark Matth » Tue, 17 May 2005 06:51:40


What happens if you try to telnet to 192.168.2.3 port 3306? If it
connects, then there's something going on with the JDBC driver. My guess
is that it _won't_ connect and your database server isn't listening to
TCP/IP on that port, or it's firewalled somehow.

-Mark

--
Mark Matthews
MySQL AB, Software Development Manager - Connectivity
www.mysql.com

 
 
 

MySQL JDBC Fails to connect but MySQL Query Browser works....

Post by RunZicoRu » Tue, 17 May 2005 08:33:30

I'm running my jdbc and MySQL Query Browser client on windows XP. MySQL
Query Browser works. MySQL Query Browser is able to connect to my linux
box. There are no firewalls. I can telnet to that port, but I can't run
queries on it. It needs a special handshake.

Thanks for the info. The connection is there but jbdc is not working.

Hany
 
 
 

MySQL JDBC Fails to connect but MySQL Query Browser works....

Post by RunZicoRu » Tue, 17 May 2005 10:07:19


I got the connection to work by downloading an older version of the
JDBC 3.0.16 I believe.

Thanks.