I am using Derby embedded driver and have added derby.jar to dependencies (I’m using Eclipse).
This is how I create tables:
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
conn=DriverManager.getConnection("jdbc:derby:myDB;create=true;");
conn.setAutoCommit(false);
Statement s=conn.createStatement();
s.execute("create table Vodici(ID int NOT NULL GENERATED ALWAYS AS IDENTITY, ime varchar(20), priimek varchar(20))");
It works good but if I close the program, start it again (with table creation lines commented out ofcourse) it says that
java.sql.SQLSyntaxErrorException: Table/View ‘VODICI’ does not exist.
when I want to access table from my program. What is wrong, there is no persistence?
Extending the comment to a reply; please try out by setting the auto commit (on connection) to true.