Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Bertrand Delacretaz
Hi Craig, On Thu, May 31, 2012 at 7:01 PM, Craig S. Dickson wrote: > ...I want to refactor my code so that the Connections are managed externally > to my code instead of creating them myself. That way the details of the actual > connection are all removed from my source code... Starting from the

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Marius Giepz
Not sure if that is what you want, but i usually publish a datasource via blueprint (aries) like: value="jdbc:hsqldb:hsql://localhost:9001/foodmart" /> and in the bundle that uses it, i look up the service like ServiceReference[] dsRefs = bundleContext.getServiceReferen

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Craig S. Dickson
Thanks Justin. Right now the ORM piece is pretty easy and I am just using stating SQL statements etc. If things get more complicated I will keep the JPA stuff from Aries in mind. BTW, do you happen to know if Aries and CQ play nicely together? On May 31, 2012, at 5:00 AM, Justin Edelson wro

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Sarwar Bhuiyan
I'm pretty sure you can find some make or find some osgi bundle which implements a set of connection pools. That's the way it's done in CQ5. Then basically, you can create instances of the pool in Felix which is accessible by the PID of the pool service. Sarwar On Thu, May 31, 2012 at 6:01 PM,

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Craig S. Dickson
Thanks Bertrand and Sarwar. My original post didn't mention it, but I do actually have a prototype up and running making simple JDBC connections from within an OSGI component, so I have the mechanics of loading drivers and making a connection working already. The main problem with the prototype

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Justin Edelson
Hi Craig, Actually I was referring to the JPA Service (as your original email mentioned Hibernate) and the JDBC Service specifications. I thought Aries implemented both, but it appears to only implement the former. Regards, Justin On Thu, May 31, 2012 at 4:01 AM, Craig S. Dickson wrote: > HI Jus

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Bertrand Delacretaz
Hi, On Thu, May 31, 2012 at 12:25 AM, Craig S. Dickson wrote: > ...In a "traditional" web app, I would probably use JNDI to look up a JDBC > DataSource object under a pre-defined name. This way specific connection > details, including security credentials are abstracted out of my code. > > Is the

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Sarwar Bhuiyan
Hi Craig, This is more an OSGi question than a Sling question. A simple thing you can do is to install a bundle containing the JDBC Driver. Maybe an osgified bundle already exists or you can convert the jar to an osgi bundle with the right packages for the driver exposed. Then the next step is

Re: Connecting to a JDBC DB from Sling

2012-05-31 Thread Craig S. Dickson
HI Justin, Thanks for the link to Aries. My initial thought though is that Aries feels a little like a sledgehammer and my problem is just a walnut. I do see how Aries could be used to provide a JNDI context in an OSGI world, but I am not necessarily tied to using JNDI, I just mentioned it as