Hello,
Yep, it's me again.. learning JDBC.... SLOWLY. Anyway, I have read through a number of posts on this, and have not found any threads that answer my question.
I am working through the Sun JDBC tutorial using the COFFEEBREAK database. I have written the following code:
import java.sql.*;
public class FirstJDBC {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
System.setProperty("derby.system.home","c:\\program files\\java\\jdk1.6.0\\db\\demo\\databases");
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/COFFEEBREAK;"."username","password");
}
}
When I step through the code, I get:
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/COFFEEBREAK;
I do have the EmbeddedDriver class in the appropriate location (%PROJECTHOME%/build/classes/org/apache/derby/jdbc/EmbeddedDriver.class)
I am using Netbeans 5.5
I have read some posts that say that this exception indicates either that:
1) You do not have an appropriate driver loaded for the database you are trying to connect to
2) There is a problem with the URL supplied in the getConnection() method.
I was told that this is the driver I should be using. Is that wrong? If so, can anyone tell me which driver I should be using?
Is the URL I'm using correct?
Please let me know if any more info is needed. Thanks in advance for any help.