Subject | ClassNotFoundException |
---|---|
Author | dbrogers3 |
Post date | 2003-12-12T22:50:35Z |
Hi!
I'm a newbee to firebird (and to java, that matter) and I'm trying to
get a simple script to work. It compiles just fine in the javabeans
IDE, but a runtime error occurs. Here's the script:
import java.sql.*;
public class List_Students {
public static void main(String args[]) {
String query = "select ID, name from student";
try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
System.out.println("JDBC Driver loaded");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
java.util.Properties properties = new java.util.Properties();
properties.put ("user", "sysdba");
properties.put ("password", "masterkey");
try {
Connection conn = DriverManager.getConnection
("jdbc:firebirdsql://localhost/C:/Firebird/univer.fdb",
properties);
System.out.println("Connecction established");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
int rowCount = 1;
while (rs.next()) {
System.out.println("Row " + rowCount + ": ");
for (int i = 1; i <= numberOfColumns; i++) {
System.out.print(" Column " + i + ": ");
System.out.println(rs.getString(i));
}
System.out.println("");
rowCount++;
}
stmt.close();
conn.close();
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
}
}
}
ClassNotFoundException: org.firebirdsql.jdbc.FBDriver
SQLException: No suitable driver
What do I need to do, here, anyone?
Thanks, Dave
I'm a newbee to firebird (and to java, that matter) and I'm trying to
get a simple script to work. It compiles just fine in the javabeans
IDE, but a runtime error occurs. Here's the script:
import java.sql.*;
public class List_Students {
public static void main(String args[]) {
String query = "select ID, name from student";
try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
System.out.println("JDBC Driver loaded");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
java.util.Properties properties = new java.util.Properties();
properties.put ("user", "sysdba");
properties.put ("password", "masterkey");
try {
Connection conn = DriverManager.getConnection
("jdbc:firebirdsql://localhost/C:/Firebird/univer.fdb",
properties);
System.out.println("Connecction established");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
int rowCount = 1;
while (rs.next()) {
System.out.println("Row " + rowCount + ": ");
for (int i = 1; i <= numberOfColumns; i++) {
System.out.print(" Column " + i + ": ");
System.out.println(rs.getString(i));
}
System.out.println("");
rowCount++;
}
stmt.close();
conn.close();
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
}
}
}
ClassNotFoundException: org.firebirdsql.jdbc.FBDriver
SQLException: No suitable driver
What do I need to do, here, anyone?
Thanks, Dave