import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class DerbyTest {
private Connection connect = null;
private Statement statement = null;
private ResultSet resultSet = null;
public DerbyTest() throws Exception {
try {
Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
connect = DriverManager.getConnection("jdbc:derby://localhost:`1527/vineet");
statement=connect.createStatement();
resultSet = statement.executeQuery("SELECT * FROM EMPLOYEE");
while (resultSet.next()) {
String user = resultSet.getString("name");
String number = resultSet.getString("number");
System.out.println("User: " + user);
System.out.println("ID: " + number);
}
} catch (Exception e) {
throw e;
} finally {
close();
}
}
private void close() {
try {
if (resultSet != null) {
resultSet.close();
}
if (statement != null) {
statement.close();
}
if (connect != null) {
connect.close();
}
} catch (Exception e) {
}
}
public static void main(String[] args) throws Exception {
DerbyTest dao = new DerbyTest();
}
}
when the above code snippet is executed the is no class found exception.how can i connect to derby embeddeddriver? because when i create a database in netbeans the it automatically get connected to derby networkdriver or clientdriver as in the above code snippet ,so please help me out.