Hi, This is basically a duplicate of this question: http://stackoverflow.com/questions/18924873/h2-embedded-database-loses-tables-data-on-deploymen
Regards, Thomas On Sat, Sep 21, 2013 at 8:34 PM, Josh <[email protected]> wrote: > Hi there, > > I need a step by step instructions on how to get a database to be deployed > with an application when it installs. > > I have looked at the h2 database engine but cannot figure it out, I am new > to java, and database integration. This is my process so far: > > 1 - Add external Jar file for h2 in eclipse project > 2 - Connect using this code: > > Class.forName("org.h2.Driver"); > Connection conn = DriverManager. > getConnection("jdbc:h2:~/crm", "sa", ""); > java.sql.PreparedStatement statement = conn.prepareStatement("SELECT * > FROM `test`"); > ResultSet result = statement.executeQuery(); > while(result.next()){ > JOptionPane.showMessageDialog(null, result.getString(2)); > } > conn.close(); > > 3 - Export file to deksop as jar with libraries in a folder. > 4 - access jar file (with eclipse open, and then closed) and it works > 5 - copy files over to laptop > 6 - open jar on laptop and it doesnt run > 7 - open jar on laptop from cmd and it says table cannot be found. > 8 - open h2 jar file, table is there, but no tables I created are there > any more. > > The application runs of data already in the database so the program needs > to "ship" with the database information already in. BUT then the app needs > to update and add data to the database aswell. > > PLEASE HELP as it is due next week friday (We got it on tuesday, I have > completed it with a alocalhost database, but that wont work unless the > database is installed on the client pc along with mysql server or something) > > Thanks in advance, > Josh > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/groups/opt_out.
