Category: RandomQueryGenerator

RandomQueryGeneratorJavaDBForRQGUsers

A short JavaDB crash course for RQG users

Contents

[edit] On JavaDB

JavaDB is Sun's branded version of Apache Derby pure Java SQL database. JavaDB may both run in embedded mode and server mode and both. In the rest of this document, I will use the term Derby.

[edit] What you need

[edit] Notes

Exception in thread "main" java.lang.InternalError: One of the management beans is not compliant. 

removing the following packages (at least on Ubuntu) helped:

log4j:WARN No appenders could be found for logger (com.vizdom.dbd.jdbc.Server).
log4j:WARN Please initialize the log4j system properly.

It is because you need a log4j properties file, the DBD_JDBC tarball contains a sample:

DBD-JDBC-0.71/t/hsqldb/log4j.properties.  

This file needs to be in the classpath (just add it to the -classpath statement in the embedded server example below)
All logging is off in this sample, please consult the DBD-JDBC page for more information on how to alter logging.

[edit] Running ij

ij is Derby command line tool. The easiest way to run Derby is to use ij and embedded Derby, like this:

java -jar /path/to/derbyrun.jar ij
ij> connect 'jdbc:derby:memory:mydatabase;create=true';
ij> .... SQL statements

This will create an in-memory database which you may use.

Read the Derby docs for more details on the URL. (http://db.apache.org/derby/manuals/index.html#docs_10.5)

[edit] Running the DBD::JDBC Server

I prefer to run the DBD::JDBC server with the JavaDB network server started. In this way, I may access the same database through DBI (using an embedded JavaDB database inside the DBD::JDBC server) and though the Derby Network Client driver.

I start the server like this:

java -Ddbd.port=1234 -Djdbc.drivers=org.apache.derby.EmbeddedDriver \
  -Dderby.drda.startNetworkServer=true \
  -classpath /path/to/dbd_jdbc.jar:/path/to/log4j-1.2.15.jar:/path/to/derbynet.jar \
  com.vizdom.dbd.jdbc.Server

[edit] The DSN

A DSN for a Deby database will look like this:

dbi:JDBC:host=somehost;port=1234;url=jdbcurl

The RQG assumes that url= is the last dsn attribute. This is because ";" and "=" needs to be encoded before connect is called to avoid confusion in DBI. Complete example on the command line (gentest.pl):

--dsn2=dbi:JDBC:hostname=localhost\;port=1234\;url=jdbc:derby:memory:test\;create=true 

Retrieved from "http://forge.mysql.com/wiki/RandomQueryGeneratorJavaDBForRQGUsers"

This page has been accessed 1,898 times. This page was last modified 21:49, 28 October 2009.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...