Search This Blog

Sunday, November 14, 2010

Using embedded DerbyDB

first i created the DB , using the ij tool .
i jar the db directory file into one jar file (dbs.jar).
i add to my class path the derby.jar file and dbs.jar.
i used the next method call
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
DriverManager.getConnection("jdbc:derby:classpath:mydb",m_connectionProperties);


if you want to run a script programmticly ,

The Derby Tools Library(derbytools.jar) contains a class named 'ij' which provides a static method called 'runScript'. This is the key to accomplishing what you want.
NOTE: The 'runScript' method returns the number of errors that occurred during the execution of the script.

http://db.apache.org/derby/javadoc/publishedapi/jdbc4/org/apache/derby/tools/ij.html
 
enjoy
Yaniv T

No comments: