my project is giving the following error: Exception in thread "main" java.lang.ClassNotFoundException: org.apache.jerby.jdbc.EmbeddedDriver Here is my CreateDatabase code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
//jj
public class CreateDB {
private static final String DRIVER = "org.apache.jerby.jdbc.EmbeddedDriver";
private static final String JDBC_URL = "jdbc:derby:test;create=true";
public static void main(String[] args) throws SQLException, ClassNotFoundException{
Class.forName(DRIVER);
Connection connection = DriverManager.getConnection(JDBC_URL);
connection.createStatement().execute("Create table channels");
connection.createStatement().execute("Inserting values");
System.out.println("Database created, records inserted.");
}
}
Since you're using Eclipse, you can right click on your project and within the context menu select: "Build Path" -> "Configure Build Path..."
Click on the Libraries tab and then click the "Add JARs..." button and add the jar file that contains your embedded driver.