Running the SQL2JAVA example
The SQL2JAVA example can be run in less than five minutes. It generates a
DB layer API to access a simple database schema (on hsql), Javadoc, and more!
Minimum requirements
We assume Java and Ant have already been installed.
Run it yourself in less than 5 minutes
- Open a console, and go to sql2java home directory.
- Now from this console, start the hsql server (we use hsql only to run the example):
NOTE: In Windows, type
to keep hsql running in the background and immediately
access a new command console.)
- Open another console, go to sql2java home directy and create the sample database schema:
- Generate the Java API for accessing the sample database:
- Take a look at the generated source code API
- Now, compile the generated source code:
- We wrote a sample program that uses the generated API, you can run it now:
- Don't forget to generate the Javadoc:
- Try sql2java against your own schema. Take a look at sql2java.properties; it is self documented (you must edit at least section 1/8 and 2/8)
- If you need to customize the generated code, edit sql2java templates:
And if you think your patch could be useful to others, please share your work...
- You can also add your own templates...
- Enjoy!