General

What is SQL2JAVA ?

Please look here



How do I test SQL2JAVA with my database?

See our working example for instructions on testing SQL2JAVA with your database.



What are the requirements for running SQL2JAVA?

SQL2JAVA requires a relational database and the Java Runtime Engine, Java 1.4.0 or later.

These are just some of the databases currently working with SQL2JAVA.

Please contact us if you're using, or would like to use, SQL2JAVA with a database platform not listed here.



Additionally, SQL2JAVA supports retrieval of auto-generated keys. This includes:
  • all databases with a jdbc 3.0 driver
  • all databases listed above



How do I add support for my database?

To add support for a new database or add retrieval of auto-generated keys for a new database, edit sql2java.properties.



Who are the SQL2JAVA developers? How Can I get involved?

If you'd like to help out, create a SourceForge user, look at the code, and send an email on the forum to be added to the project developer list.



Logging

How can I log all the sql statements ?

Check http://www.p6spy.com/.

They provide a free jdbc driver that wraps the real jdbc driver and logs all you can dream of.

In your project.properties please set the following properties:

  • jdbc.driver=com.p6spy.engine.spy.P6SpyDriver
  • jdbc.spydriver=org.hsqldb.jdbcDriver



Templates

How can I extend/modify the generated code

Please go in your src/templates/ folder, look for the template you want to modify. ... and modify whatever needs to be modified to suits your needs.



How can I add a new template ?

You have 2 options, your template needs to be executed once per generation, then place your template in folder with a name called perschema in src/templates/. If you want your template to be executed for every table, call the folder pertable exemple:

                src/templates/myplugin/perschema/mytemplate_for_each_schema.vm
                src/templates/myplugin/pertable/mytemplate_for_every_table.vm
            



My template is very simple, and yet does not execute correctly ?

You certainly have another file with the same filename in the template path described in sql2java.properties. Please rename your file, and there you go !



Why is there no database graphics like in your sample ?

Please install http://www.research.att.com/sw/tools/graphviz/ in your C:/Program Files/ATT/Graphviz/ folder. If you are under unix, please update the following template to match your configuration src/templates/velocity/db/perschema/graphviz/ant.graphviz.xml.vm