I've managed to convince myself that pax-jdbc is either doing the wrong 
thing, the right thing, the wrong thing because the right thing is 
impossible.  So I give up, and  ask what the general consensus is on what 
version number to use for JDBC DataSourceFactory registrations. 

I'm trying to add a native DataSourceFactory to the netty based postgresql 
jdbc driver.  Due to stupid mistake in my activator, I ended up calling 
Class::toString instead of Class::getName when registering the service; as 
a result, pax-jdbc didn't match on the registered driver, so created an 
instance of the generic DriverDataSourceFactory.  

Whilst looking a the properties for the two services, I noticed that:

The generic factory was using the bundle version for the 
OSGI_JDBC_DRIVER_VERSION property (in this case "0.8.0.SNAPSHOT").  
I was using the major  + minor version from the Driver::getMajorVersion and 
Driver::getMinorVersion  (in this case "0.1" ).
After creating a datasource, examining it with karaf's  jdbc:ds-info showed 
a Driver Version of "0.1.0", which turns out to be the value of 
DatabaseMetaData::getDriverVersion.  There is no equivalent method 
available on Driver, so there's no generic way to get the full driver 
version without having made a database connection.

Not appearing in this episode:  the version of the package for the driver 
class is "1.0.0".  Which becomes irrelevant if I don't export that package. 

I think the bundle version may be the right thing (after checking and 
discovering that the driver version hadn't been changed for four years!)

Also, am I right in thinking that osgi.jdbc.driver.version is just a string 
and not a :Version?  
 

Simon

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to