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;
}
}