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 --------------------------------------------------------------------- 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