|
-
March 10th, 2002, 07:50 PM
#1
Help!!! Connecting to a DB
hi,
I am a beginner at Jbuilder and I am writing a test class which connects to a database. I have written the following code, but I get the error -
" java.lang.NoClassDefFoundError: junit/textui/TestRunner
Exception in thread "main" "
Does anyone know what I may be doing wrong, or what I have to do to get this to work?
Thanks heaps.
package prudentia;
import sun.jdbc.odbc.JdbcOdbcDriver.*;
import java.sql.*;
import java.io.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class PrudclsDBConnect {
static Connection connection;
static String driver = "COM.cloudscape.core.JDBCDriver";
String url = "jdbc dbc.north ";
String user = "";
String password = "";
public void initialize() throws SQLException {
//Class.forName(driver);
connection = DriverManager.getConnection(url, user, password);
System.out.println("Hello World");
}
public void close() throws SQLException
{
try {
connection.close();
} catch (SQLException e) {
throw e;
}
}
public static void main(String[] args)
{
PrudclsDBConnect clsDBConnect = new PrudclsDBConnect();
try {
clsDBConnect.initialize();
clsDBConnect.close();
} catch(SQLException sqlException) {
while(sqlException != null)
{
sqlException.printStackTrace();
sqlException = sqlException.getNextException();
}
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|