11 messages in com.mysql.lists.javaRe: How to connect to a MySQL DB whic...
FromSent OnAttachments
Shridhar18 Feb 2003 02:01 
raf...@dcit.com18 Feb 2003 07:36 
Shridhar18 Feb 2003 19:55 
raf...@dcit.com19 Feb 2003 07:10 
Keith Knaide19 Feb 2003 07:12 
G. Wayne Kidd19 Feb 2003 07:43 
raf...@dcit.com19 Feb 2003 08:03 
George Pitcher19 Feb 2003 08:35 
Keith Knaide19 Feb 2003 09:13 
bbon...@tampabay.rr.com19 Feb 2003 11:28 
Shridhar19 Feb 2003 20:44 
Subject:Re: How to connect to a MySQL DB which is on a remote machine..
From:Shridhar (Shri@hotmail.com)
Date:02/19/2003 08:44:47 PM
List:com.mysql.lists.java

Hi All,

Thankzz for your reply.

Now it is working fine, the problem was with the firewall between my machine and the remotemachine, i tried connecting to that remote machine with out the firewall, it connects..

Hi.

OK, so the issue you are having really doesnt have anything to do with JDBC ... so this is not the list to cover this ... but, you might want to try a few basic things...

1. Are you sure mysql is running? Can you connect to it using the mysql client from the same machine?

2. If #1 is YES, is there a firewall between you and the machine you are trying to connect to? Port 3304 (default port) needs to be reachable.

start with these. Again, I dont think this is an appropriate discussion for the java list so try resolving this issue on one of the other lists (where appropriate) or feel free to email me directly and I'll try to help as much as I can.

cheers.

Shridhar wrote:

Hello,

No, i am not able to connect to the remote machine with myqsl client .. i tried these commands , it is throwing the following Error..

C:\>mysql -h 203.197.167.163 -u root ERROR 2003: Can't connect to MySQL server on '203.197.167.163' (10060)

C:\>mysql -h 203.197.167.163 -u root -p Enter password: root ERROR 2003: Can't connect to MySQL server on '203.197.167.163' (10060)

what might be the problem????

----- Original Message ----- From: <raf@dcit.com> To: <ja@lists.mysql.com> Sent: Tuesday, February 18, 2003 21:06 Subject: Re: How to connect to a MySQL DB which is on a remote machine..

Can you ping the other box? Can you connect to the mysql server running on the other machine from a mysql client on your "coding" machine?

Shridhar wrote:

Hi All,

How to connect to a MySQL db which is on a remote machine I tried the , but i'm getting SQLException.. Please tell me where am i going wrong..

Thanks, Shridhar..

The Code: =======

try { System.out.println("Hello "); Class.forName("org.gjt.mm.mysql.Driver"); System.out.println("Class Loaded : "); String url = "jdbc:mysql://IPAddr_of_remote_machine/dbName"; Connection dbCon = DriverManager.getConnection(url, "root", ""); System.out.println("conn : "); Statement vSt = dbCon.createStatement(); System.out.println("stmt : "); String ReqStr = "select * from test_table"; ResultSet vRs = vSt.executeQuery(ReqStr); while(vRs.next()) { System.out.println(vRs.getString(1)); } } catch(Exception e) { e.printStackTrace() ; }

Output : ======

Hello Class Loaded : java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection timed out: connect at com.mysql.jdbc.Connection.createNewIO(Connection.java:1670) at com.mysql.jdbc.Connection.connectionInit(Connection.java:901) at com.mysql.jdbc.Driver.connect(Driver.java:311) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:171) at aa.main(aa.java:19) Interactive Session Ended

To request this thread, e-mail <java@lists.mysql.com> To unsubscribe, e-mail

<java-unsubscribe-raffi=dcit@lists.mysql.com>

To request this thread, e-mail <java@lists.mysql.com> To unsubscribe, e-mail

<java-unsubscribe-shri1976=hotm@lists.mysql.com>