It seems that either your server was started with the "--skip-networking" flag, or that it's not listening on port 3306 (check your my.cnf), or your machine has a firewall installed locally that doesn't allow network connections to port 3306.
The MySQL command-line client will probably work in any of these cases, as it uses Unix domain sockets, which are really filesystem-based. You should read the MySQL manual's installation section and use what you learn there to figure out how your mysqld is configured. You won't be able to connect to it using JDBC until you know for a fact that it is allowing TCP/IP connections, what port you should connect on (3306 by default), and that you don't have anything on your machine that prevents you from connecting to that port. -Mark ----- Original Message ----- From: "Lee, Andrew" <[EMAIL PROTECTED]> To: "'debian'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 06, 2002 8:23 PM Subject: RE: Cannot connect to MySQL server with a java application > Almost, but not exactly the same ..... > > DriverManager.getConnection(dburl, dbuser, dbpasswd) <-- note, 3 arguments > here > > > -----Original Message----- > > From: debian [SMTP:[EMAIL PROTECTED]] > > Sent: Wednesday, February 06, 2002 1:59 PM > > To: [EMAIL PROTECTED] > > Subject: Cannot connect to MySQL server with a java application > > > > hello, > > > > i tried to connect my MySQL-Server with a short java application. The > > application can't connect to the server, obviously the server is running > > on > > localhost:3306. I append the SourceCode (roughly the same: > > http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:80228:200107:popciohjmlbbolp > > ak > > ) and the error-message. > > > > SourceCode: > > import java.sql.*; > > > > class SQLtest2 > > { > > public static void main(String[] args) > > { > > try > > { > > Class.forName("org.gjt.mm.mysql.Driver").newInstance(); > > System.out.println("register the Driver: OK"); > > } > > catch (Exception e){} > > try > > { > > Connection conn = > > DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test?user=test&pa > > ss > > word=teschd"); > > System.out.println("... ccnnected"); > > Statement s = conn.createStatement(); > > s.close(); > > conn.close(); > > } > > catch(SQLException e) > > { > > System.out.println("SQLException: " + e.getMessage()); > > System.out.println("SQLState: " + e.getSQLState()); > > System.out.println("VendorError: " + e.getErrorCode()); > > } > > > > } > > } > > > > Error-Msg: > > > > register the Driver: OK > > java.io.IOException: Connection timed out > > at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:56) > > (some EXCeptions more) > > SQLException: Cannot connect to MySQL server on 127.0.0.1:3306. Is there a > > MySQL server running on the machine/port you are trying to connect to? > > (java.io.IOException) > > SQLState: 08S01 > > VendorError: 0 > > > > is there somebody who can help me? > > > > thnx bobby > > --------------------------------------------------------------------- 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