Error connecting to MySQL from RAD
Posted by:
Arlene Paul ()
Date: January 23, 2006 02:51PM
Hi
I am trying to connect to MySQL from IBM's Rational Software Developement Platform ver 6.0. I am a developer working from home.
Here is my code.
connectToDB()
try {
Class.forName(driver);
} catch (ClassNotFoundException ce) {
throw new ConnectionFailureException(ce.toString(), ce);
}
try {
conn = DriverManager.getConnection ('jdbc:mysql://127.0.0.1:3306/load_db' ,'root','admin');
} catch (SQLException se) {
throw new ConnectionFailureException(se.toString(), se);
}
}
This is the error i am getting.
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.SocketException: Invalid argument: connect
STACKTRACE:
java.net.SocketException: java.net.SocketException: Invalid argument: connect
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2555)
at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:539)
at java.sql.DriverManager.getConnection(DriverManager.java:189)
at com.loanapp.util.DataBaseConnector.connectToDB(DataBaseConnector.java:44)
at com.loanapp.loanMain.main(loanMain.java:24)
** END NESTED EXCEPTION **
Last packet sent to the server was 47 ms ago.
com.loanapp.Exception.ConnectionFailureException: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.SocketException: Invalid argument: connect
STACKTRACE:
java.net.SocketException: java.net.SocketException: Invalid argument: connect
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2555)
at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:539)
at java.sql.DriverManager.getConnection(DriverManager.java:189)
at com.loanapp.util.DataBaseConnector.connectToDB(DataBaseConnector.java:44)
at com.loanapp.loanMain.main(loanMain.java:24)
** END NESTED EXCEPTION **
Last packet sent to the server was 47 ms ago.
Please help!!
Thanks in advance.
Arlene
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.