I've never connected your way before.  I'm using J/Connector from the MySQL site 
(http://www.mysql.com/downloads/api-jdbc-stable.html).  That way I have no problems 
connecting.  I do it this way:


// connect to the database
Class.forName("com.mysql.jdbc.Driver");
Connection dbConnection = 
DriverManager.getConnection("jdbc:mysql://localhost/myTable", "username", "password");

        Works like a charm.  Give it a try...

-Pete

-----Original Message-----
From: Muhammad Salman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 12, 2002 11:36
To: [EMAIL PROTECTED]
Subject: Remote Connection, please help


I am using the official type 4 mysql driver from
www.mysql.com but unable to make a remote connection
with the mysql database running on our companie's
remote server. I mailed some mailing mailing lists but
didnt find out the right answer yet. I am using the
following code for simple remote connection test: 

Class.forName("org.gjt.mm.mysql.Driver").newInstance();
  Connection con =
DriverManager.getConnection("jdbc:mysql://66.137.7.185:3306/prefill","prefill","jeem");
  out.println("Testing Database Connectivity");
  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery("select * from
state");
  int i = 0;
  while(rs.next() && i < 10)
     {
     out.println("<h2> Output: "+rs.getString(2) +
"</h2>");
     i ++;
     }
  rs.close();   
  stmt.close();
  con.close();   

Your quick response will be highly appreciated.



=====

Muhammad Salman
Sun Certified Java 2 Programmer
+92214932737 (H)
+923332234828(C 1)
+923332103334(C 2)
Email: [EMAIL PROTECTED]
Text Pager: [EMAIL PROTECTED]
Work Web: http://www.jeemsolutions.com


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to