Subject | problems with Class.forName |
---|---|
Author | Harrison, Matthew |
Post date | 2002-05-16T19:07:01Z |
Hi all-
I'm trying to test out firebird but am having trouble connecting.
I get an
java.lang.NoClassDefFoundError: javax/resource/ResourceException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.kanisa.GSBuilder.DataAccess.DataObject.<init>(DataObject.java:39)
at com.kanisa.GSBuilder.DataAccess.DataObjectFactory.getDataObject(DataObjectFactory.java:26)
at com.kanisa.GSBuilder.DataAccess.DataAccessTester.testCreateBaseTypes(DataAccessTester.java:61)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:166)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:319)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:215)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:150)
error when trying to run the test. It works fine if I use the SQL Server
lines above that are commented out.
Am I not importing the right things? I know that the firebirdsql.jar is
in my classpath.
Any hints on connecting? It appears that I've tried what the release notes
say.
thanks
matt
ps-heres some relevant code
import java.util.*;
import java.sql.*;
import org.firebirdsql.*;
/**
*
* Main data object.
*/
public class DataObject
{
protected DataObject()
{
nodeHash = new Hashtable();
try
{
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//con = DriverManager.getConnection("jdbc:odbc:GSBuilder", "sa", "");
Class.forName("org.firebirdsql.jdbc.FBDriver");
con = DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:D:\\Program Files\\Firebird\\bin\\GSBUILDER.GDB", "SYSDBA", "masterkey");
}
catch (ClassNotFoundException e)
{
}
catch (SQLException se)
{
}
}
I'm trying to test out firebird but am having trouble connecting.
I get an
java.lang.NoClassDefFoundError: javax/resource/ResourceException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.kanisa.GSBuilder.DataAccess.DataObject.<init>(DataObject.java:39)
at com.kanisa.GSBuilder.DataAccess.DataObjectFactory.getDataObject(DataObjectFactory.java:26)
at com.kanisa.GSBuilder.DataAccess.DataAccessTester.testCreateBaseTypes(DataAccessTester.java:61)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:166)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:319)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:215)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:150)
error when trying to run the test. It works fine if I use the SQL Server
lines above that are commented out.
Am I not importing the right things? I know that the firebirdsql.jar is
in my classpath.
Any hints on connecting? It appears that I've tried what the release notes
say.
thanks
matt
ps-heres some relevant code
import java.util.*;
import java.sql.*;
import org.firebirdsql.*;
/**
*
* Main data object.
*/
public class DataObject
{
protected DataObject()
{
nodeHash = new Hashtable();
try
{
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//con = DriverManager.getConnection("jdbc:odbc:GSBuilder", "sa", "");
Class.forName("org.firebirdsql.jdbc.FBDriver");
con = DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:D:\\Program Files\\Firebird\\bin\\GSBUILDER.GDB", "SYSDBA", "masterkey");
}
catch (ClassNotFoundException e)
{
}
catch (SQLException se)
{
}
}