Problem connecting to MySql server from JDBC - MESSAGE: java.net.SocketException: Invalid argument: connect
Posted by: Milind Joshi
Date: February 17, 2005 08:12PM

Hi,

I am having problem connecting to MySQl server Version 4.1 from JDBC driver mysql-connector-java-3.1.6. I am getting the following error.

com.mysql.jdbc.CommunicationsException: Communications link failure due to under
lying 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.ja
va:151)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1699)
at com.mysql.jdbc.Connection.<init>(Connection.java:405)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:268)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at LoadDriver.main(LoadDriver.java:19)


** END NESTED EXCEPTION **

I am using the similar code that is given in the MySql documentation. Here is it.


import java.sql.*;
import java.sql.DriverManager;
import java.sql.SQLException;

public class LoadDriver {

public static void main(String[] args) {
try{
Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost/mine?user=root1&password=Passwd1");
}catch(Exception e){System.out.println(e);}

}// main ends
}// class LoadDriver ends



Please help!!!

Thanks,
Milind

Options: ReplyQuote


Subject
Written By
Posted
Problem connecting to MySql server from JDBC - MESSAGE: java.net.SocketException: Invalid argument: connect
February 17, 2005 08:12PM


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.