[QFJ-164] Add ability to set data source directly on log/store and remove JNDI property initialization. Created: 23/Apr/07 Updated: 04/Jul/07 Resolved: 31/May/07 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | None |
Affects Version/s: | 1.1.0 |
Fix Version/s: | 1.2.0 |
Type: | Improvement | Priority: | Default |
Reporter: | Jörg Thönnes | Assignee: | Jörg Thönnes |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Environment: |
JBoss deployed data sources |
Description |
JDBC data sources deployed in JBoss cannot be accessed. The JBoss jndi,properties file contains something like this: java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory Actually, only the first and the third properties can be set using the QF/J settings. Accessing the data sources fails. I suggest to add this and possibly other JNDI properties to JdbcUtils.getDataSource(). If just the data source is defined in the QF/J settings, a JNDI lookup is tried. In that case, all possible JNDI properties are fetched from the settings. If a property cannot be find, this will be ignored. If there is no other JNDI property set, the default new InitialContext() without arguments is tried. It will pick up its configuration from the resource "jndi.properties" found using the class loader. Otherwise, the configuration using direct JDBC driver and URL etc. is used. |
Comments |
Comment by Steve Bate [ 11/May/07 ] |
I'm wondering if I should go the other direction. When running inside an application server, the initial context should already be configured. So just creating the InitialContext() instance would be enough (with no environment). At least I know this is true for the application servers I've used. I'm not familiar with JBoss. Does it work the same way? Even if I don't support any JNDI properties directly in the code, they can still be set in various other ways (as you mentioned). At the time I wrote the original code I wasn't sure how it would work in an application server context. Thoughts? |
Comment by Brad Harvey [ 12/May/07 ] |
Hi Steve, JBoss works the same way - you shouldn't need any JNDI context settings if you're connecting within the JVM (and I don't think it makes datasources available outside the JVM, but could be wrong). Maybe a separate option to pass the DataSource programatically to JdbcxxxFactory and have it pass it directly to JdbcStore/Log would be useful? This way the user can have complete control over how the data source is found (JNDI, commons-dbcp, proxool etc). Disclaimer: I don't use JDBC with quickfix/j Cheers, |
Comment by Steve Bate [ 19/May/07 ] |
Thanks, Brad. I don't often use the JDBC plugins either. Jörg, what do you think about these suggestions? I'd be removing the existing settings-based properties and adding the capability to set the datasource explicitly on the factory. Or you could make the changes, if you'd like. |
Comment by Jörg Thönnes [ 21/May/07 ] |
I would like to keep JdbcSetting.SETTING_JDBC_DS_NAME. In addition, if also JdbcSetting.SETTING_JNDI_PROVIDER_URL is set, the InitialContext should be creating using the Hashtable The ability to set the data source programmatically would be an extra option which makes much sense. But in general, I would My background to use the data source that I have code that should run both in the application server and in a standalone JVM. |
Comment by Steve Bate [ 25/May/07 ] |
Accidentally resolved the wrong issue. |
Comment by Jörg Thönnes [ 30/May/07 ] |
JdbcUtil: Removed empty HashMap argument from InitialContext constructor. |