Am Montag, 2. Juli 2007 schrieb Brandon Dohman:
> I have recently written a small client/server program in java.  I have the
> client connect to the server and send information back and forth.  the
> server is on the same computer as the derby database, and handles all the
> communication between the java code and the derby database, ie: sql
> commands.  Currently i am starting derby from inside the netbeans ide but
> would like to be able to have the java code start the database, so that I
> can just run the jar file w/out having to do things from inside netbeans
> all of the time.  I have looked for a way to start the database from java
> code but have been unsuccessful in finding it.  any help would be greatly
> appreciated.
>
> Thanks

Add the derby.jar to the classpath, then do:

       Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
       final Connection con = DriverManager.getConnection(
                    "jdbc:derby:/home/kurt/databasename;create=true");

-- 
Mit freundlichen Grüßen

Kurt Huwig
GnuPG 1024D/99DD9468 64B1 0C5B 82BC E16E 8940  EB6D 4C32 F908 99DD 9468

Attachment: pgp6XzMA1ZKr6.pgp
Description: PGP signature

Reply via email to