2

I created web apps with Netbeans, derby as Database (configure from Services tab successfully), and build it to be war (with derby lib - derby.jar etc). Then I used Tomcat to deploy it. But I can't see data, error said database doesn't exist.

And my question is : how to create database in order Tomcat to read the same database I used in Netbeans?

String jdbcURL = "jdbc:derby:test;create=true";
String user = "app";
String password = "app";
Connection connection = null;

public static Connection getConnection() {
    try {
        Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
         connection = DriverManager.getConnection(jdbcURL, user, password);
        System.out.println("Connected");
        return connection;
    } catch (Exception ex) {
        System.out.println("message: " + ex.getMessage() + "\nNot         connected");
        return null;
    }
}
Q. Bluv
  • 21
  • 2
  • The answer is in the syntax of your `jdbcURL` variable. Try reading these related questions closely: http://stackoverflow.com/a/12654022/193453 and http://stackoverflow.com/a/10666543/193453 and http://stackoverflow.com/a/15250321/193453 – Bryan Pendleton May 06 '16 at 02:57

0 Answers0