Absolutely. That is what I wanted to say in my last post. The only problem with this aproach is that you hardcode the database type in your bridge bundle.
( At least if you dont want to mess with the classloader).

As you probably will not have that many database types in one use case this is probably ok though.

Christian


Am 20.03.2012 11:27, schrieb Neil Bartlett:
You certainly don't need Glassfish... you don't need Karaf or Blueprint either.

There is a tendency on many mailing lists to respond to beginner questions with answers 
like "you can do this with product X" where X happens to be the product that 
the person is working on or selling. Those products may indeed add value but they are 
rarely the only or the simplest way to achieve what you want!

To register a DataSource service with pure OSGi, it's as simple as writing this 
code in a BundleActivator (using MySQL as an example):

DataSource ds = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource();
context.registerService(DataSource.class.getName(), ds, null);

This would be your "bridge" bundle that you deploy alongside the MySQL driver 
JAR. For other database types, write a different 2 lines of code and deploy that bundle 
instead.

Kind regards,
Neil



--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to