I've downloaded db-derby-10.10.1.1-bin installed it according to this guide Now when I try to run code below it says: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/derby/impl/tools/sysinfo/Main (I've installed it into orp/Apache/derby)
public class Sample2 {
public static void main(String[] args) {
System.out.println("POOP");
new Sample2().go(args);
System.out.println("SimpleApp finished");
}
void go(String[] args){
Connection conn = null;
ArrayList statements = new ArrayList();
PreparedStatement psInsert = null;
PreparedStatement psUpdate = null;
Statement s = null;
ResultSet rs = null;
String dbName = "Lab4DB";
try {
conn = DriverManager.getConnection(protocol + dbName);
System.out.println("Connected to and created database " + dbName);
conn.setAutoCommit(false);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private String framework = "embedded";
private String driver = "org.apache.derby.jdbc.EmbeddedDriver";
private String protocol = "jdbc:derby:";
}
My main class is in my workspace directory. What is the problem?
derby.jar和derbytools.jar必须存在于CLASSPATH中才能使用apache derby。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.