I created a database using the javadb netbeans derby, then created a connection on port 1527 with the name of the Bank being TEST. I created the connection string below that I should connect to the TEST Bank, but with the code below I can not connect.
package javadata;
import java.sql.*;
/**
*
* @author Djafta
*/
public class JavaData {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//PARAMETROS("jdbc:derby://host:port//DB;user=?;password=?");
Connection conn = null;
try {
conn = DriverManager.getConnection("jdbc:derby://localhost:1527/TESTE","root","root");
System.out.println("Conectado com sucesso...");
} catch (SQLException ex) {
System.out.println("Problema de conexao: " + ex);
}
//Statement sql = conn.createStatement();
}
}
Now you're giving the error securing after adding the ex.printStackTrace ();:
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/TESTE
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at javadata.JavaData.main(JavaData.java:25)