Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Geronimo Wiki" for 
change notification.

The following page has been changed by JohnSisson:
http://wiki.apache.org/geronimo/Database_Configuration

The comment on the change is:
first stab at some Derby database configuration/creation doco

------------------------------------------------------------------------------
  [[TableOfContents]]
  
  = Geronimo's Embedded Derby System =
+ 
+ '''''Note that this documentation is based upon changes that were made after 
the M3 build'''''.[[BR]]
  
  Geronimo's `org/apache/geronimo/!SystemDatabase` configuraton starts the 
["DerbySystem GBean"], ["DerbyNetwork GBean"], 
["JDBCTransactionalThreadPooledTimer GBean"], 
["JDBCNonTransactionalThreadPooledTimer GBean"], and defines the 
["SystemDatasource"] that is intended for use by Geronimo and associated 
components (e.g. ActiveMQ).  The SystemDatasource is not intended for direct 
use by J2EE applications. 
  
@@ -34, +36 @@

                  
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                  <connectiondefinition-instance>
                      <name>jdbc/MYDB</name>
-                     <config-property-setting 
name="UserName">applicationUsername</config-property-setting>
+                     <config-property-setting 
name="UserName">MYAPP</config-property-setting>
-                     <config-property-setting 
name="Password">password</config-property-setting>
+                     <config-property-setting 
name="Password">myappPassword</config-property-setting>
                      <config-property-setting 
name="DatabaseName">MYDB</config-property-setting>
                      <config-property-setting 
name="CreateDatabase">create</config-property-setting>
                      <connectionmanager>
@@ -58, +60 @@

  </connector>
  }}}
  
+ FIXME - need to confirm whether the current database schema for the above 
embedded connection will be `MYAPP`.  See 
[http://incubator.apache.org/derby/faq.html#schema_exist]
+ 
+ 
+ == Creating tables in an Embedded Derby Database via Derby's ij tool (whilst 
Geronimo is running) ==
+ 
+ Derby does not currently provide a network JDBC driver (although this will 
change soon), therefore you must download the IBM DB2 Universal Driver:
+ http://www-106.ibm.com/developerworks/db2/downloads/jcc/
+ 
+ The following DB2 Universal Driver JARs need to be on your classpath:
+   * db2jcc.jar
+   * db2jcc_license_c.jar
+   
+ To create a database using Derby's ij tool do something like the following 
(example for windows):
+ 
+ {{{
+ java -cp 
derby.jar;derbynet.jar;derbytools.jar;db2jcc.jar;db2jcc_license_c.jar  
-Dij.driver=com.ibm.db2.jcc.DB2Driver -Dij.user=MYAPP 
-Dij.password=myappPassword -Dij.protocol=jdbc:derby:net://localhost:1527/ 
org.apache.derby.tools.ij
+ ij version 10.0 (C) Copyright IBM Corp. 1997, 2004.
+ ij> connect 'MYDB;create=true';
+ ij> CREATE TABLE products(name CHAR(30), price INTEGER);
+ 0 rows inserted/updated/deleted
+ ij> disconnect;
+ ij> exit;
+ }}}
+ 
+ The above commands will result in:
+ 
+  * the MYDB database being created (if it hasn't already).  If the database 
wasn't already created, the directory "MYDB" is created for the database under 
the geronimo\var\derby (Derby system) directory.
+  * the `products` table is created in the MYDB database.
+ 
+ Note that the above ij command will only work on the localhost with the 
standard ["DerbyNetwork GBean"] configuration.  FIXME - add more information 
about this (preferably under the ["DerbyNetwork GBean"] topic.
+ 

Reply via email to