Hi, today was reading a great book 'Groovy in action', a chapter about the Data Base programming.
Authors use hsql db, so I've asked myself how to connect to Apache Derby
Here I've found the way to do that,but they connect via the driver manager which is the less preferable way to use the jdbc. AFAIK java.sql.DataSource is much better.
So, I've come up with the following solution:
- Create a groovy project in your favorite way.
- Ensure you have a jar derby.jar in your classpath.
You can find the needed jar inside the derby distribution(the latest one available for a moment) in the lib directory.
Now lets create a groovy script that looks as follows:
That's all, very easy!
Hope you've found this post useful!
Thanks a lot for attention
Wednesday, March 31, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment