7 messages in com.mysql.lists.javaRe: Connection Problem| From | Sent On | Attachments |
|---|---|---|
| Tristan O'Tierney | 27 May 2002 22:42 | |
| Charles Brown | 27 May 2002 23:15 | |
| Bruce Scharlau | 28 May 2002 00:55 | |
| Mark Matthews | 28 May 2002 03:49 | |
| Peter T. Abplanalp | 28 May 2002 07:48 | |
| Tristan O'Tierney | 28 May 2002 14:56 | |
| Peter T. Abplanalp | 28 May 2002 14:59 |
| Subject: | Re: Connection Problem![]() |
|---|---|
| From: | Peter T. Abplanalp (pt...@psaconsultants.com) |
| Date: | 05/28/2002 07:48:18 AM |
| List: | com.mysql.lists.java |
i have a friend who runs debian and we had this problem as well. the skip-networking flag can be found in /etc/my.cnf, iirc.
On Tue, May 28, 2002 at 05:49:45AM -0500, Mark Matthews wrote:
My guess is that if you installed mysql through apt, that it is not listening on any TCP/IP port, and port 3306 is firewalled on your system.
You need to remove the "--skip-networking" flag from your MySQL server startup script (I don't run Debian, so I don't know where that would be), and make sure that you're not firewalling port 3306.
Try "telnet localhost 3306" and see what happens. If that hangs as well, then the port is firewalled.
-Mark
----- Original Message ----- From: "Tristan O'Tierney" <toti...@yahoo.com> To: <ja...@lists.mysql.com> Sent: Tuesday, May 28, 2002 12:42 AM Subject: Connection Problem
I'm trying to connect to a mysql database through localhost, and i'm getting a strange problem. The server is running just fine, because it's accessable through php and command line, but when i try to use this code:
import java.sql.DriverManager; import java.sql.Connection; import java.sql.SQLException;
public class TestDatabase {
public static void main( String[] args ) { try { Connection conn = null; Class.forName( "org.gjt.mm.mysql.Driver" ).newInstance(); System.out.println ( "Instance created" ); conn = DriverManager.getConnection( "jdbc:mysql://localhost/database", "username", "password" ); System.out.println ( "Connection created" ); conn.close(); System.out.println ( "Connection closed" ); } catch ( SQLException e ) { System.err.println ( "SQL Error #: " + e.getMessage() ); System.err.println ( e.getMessage() ); } catch ( ClassNotFoundException e ) { System.err.println ( "Class Not Found" ); System.err.println ( e.getMessage() ); } catch ( InstantiationException e ) { System.err.println ( "Instantiation Error" ); System.err.println ( e.getMessage() ); } catch ( IllegalAccessException e ) { System.err.println ( "Illegal Access" ); System.err.println ( e.getClass() ); }
System.out.println ( "Exiting" ); System.exit( 0 ); }
} // TestDatabase
All that happens is "Instance created" is printed to std out, and then the program locks up. It never even gets past the DriverManager.getConnection() line. I tried letting it time out incase the connection wasn't working but after a few minutes it was still stuck in that line. I don't even know where to begin to debug this, so I'm hoping someone on the list might know where to at least start?
On a side note, I'm running Debian Linux, and Blackdown Java 1.3.1, with 2.0.14 mm.mysql
Thanks in advance
-Tristan
__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
-- Peter Abplanalp
Email: pt...@psaconsultants.com PGP: pgp.mit.edu




