java.lang.reflect.InvocationTargetException
Posted by: Martin Woolley
Date: October 08, 2005 12:23AM

Hello


I've just installed MySQL 4.1.14 along with the JDBC driver version
3.1.10.


When I try to connect to the database using a very simple Java app, I
get the following stacktrace:


** BEGIN NESTED EXCEPTION **


java.net.SocketException
MESSAGE: java.lang.reflect.InvocationTargetException


STACKTRACE:


java.net.SocketException: java.lang.reflect.InvocationTargetException
at
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
va:198)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:283)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
at com.mysql.jdbc.Connection.<init>(Connection.java:1474)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:264)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at ConnectionTester.<init>(Unknown Source)
at ConnectionTester.main(Unknown Source)


** END NESTED EXCEPTION **


I'm running on Windows XP btw. The simple Java app is as follows:


import java.io.FileInputStream;
import java.io.PrintStream;
import java.sql.DriverManager;
import java.util.Properties;


public class ConnectionTester
{


public static void main(String args[])
{
ConnectionTester connectiontester = new
ConnectionTester(args[0]);
}


public ConnectionTester(String s)
{
try
{
Properties properties = new Properties();
FileInputStream fileinputstream = new FileInputStream(s);
properties.load(fileinputstream);
java.sql.Connection connection = null;
String s1 = properties.getProperty("driver");
System.out.println("driverClassname:" + s1);
String s2 = properties.getProperty("url");
System.out.println("jdbcURL:" + s2);
String s3 = properties.getProperty("username");
System.out.println("username:" + s3);
String s4 = properties.getProperty("password");
Class.forName(s1);
connection = DriverManager.getConnection(s2, s3, s4);
System.out.println("Got connection....");
}
catch(Exception exception)
{
System.out.println(exception);
exception.printStackTrace();
}
}



}


Any ideas?

Thanks

Options: ReplyQuote


Subject
Written By
Posted
java.lang.reflect.InvocationTargetException
October 08, 2005 12:23AM


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.