commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [sql] quick heads up...
Date Thu, 12 Sep 2002 18:12:34 GMT
There's now SqlBuilder support for Axion, HsqlDb, DB2, Sybase, MSSql, MySql
and Oracle. Unfortunately its a bit hard to unit test most of those, but at
least the Java databases (Axion and HsqlDb) are part of the unit test cases
now. I'm sure we could add other, freely distributable, Java databases to
the test cases over time too.


Incidentally I've just added an experimental, simple little API for
inserting/updating/deleting data from a database via DynaBeans. Its only a
couple of classes and essentially binds the commons-sql model beans
(Database, Table, Column) to DyanClass, DynaBean and DynaProperty instances.

So you can do things like

// lets parser the model from XML
DatabaseReader reader = new DatabaseReader();
Database model = (Database) reader.parse( "mymodel.xml" );

// JDBC connection pool, maybe using DBCP and Pool from commons
DataSource source = ...;

// now lets add some data
DynaSql dynaSql = new DynaSql(source, model);

DynaBean author = dynaSql.newInstance( "author" );
author.set( "name", "James" );
author.set( "whatever", new Integer(1234));
dynaSql.insert(author);

etc.

Its kinda like an insert/update/delete version of the ResultSetDynaBean in
beanutils.

This can be handy if you want something really simple and easy or need to
create dynamic tables or handle arbitrary database schemas at runtime (which
I have to do at the moment as part of my day job). Though if your persistent
schema is more well defined, maybe tools like OJB or Torque might be more
applicable.

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message