Skip to main content

Resource re-scoping in standalone instances

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
el_eduardo
Offline
Joined: 2011-04-22

Not sure if this would make sense or not but this is what I want to achieve

1) I have one application that I want to run in a couple servers. The best option for me seems to be to use "standalone instances" so I can give the operations folks the change to have one single point of administration.

2) The application needs to connect to a couple of databases and that is the kicker here. I want "standalone instance" to connect to database A and B, "standalone instance" to connecto to database C and D. The app of course only knows its JDBC resource name which I want to have hard-coded say "jdbc/sourceDatabase", "jdbc/targetDatabase".

3) I noticed that the the resources can be deployed to a given target but what I want to do is to say "jdbc/sourceDatabase" uses "sourceDatabaseA" connection pool in target "1" and "jdbc/sourceDatabase" uses "sourceDatabaseC" in target 2. OR the jdbc resource always points to the same connection pool name but the connection parameters change based on which environment is running. Is there a way. Assuming I can do the latter, if I were to create system properties for each "standalone instance" is there a way to use them in the connection pool "Additional Properties"?

Not sure if all this makes sense.

Of course I make the app so it can be configured with the resource names it has to use for the jndi lookup but that kills things like resource injection (@Resource) and I think it will be error prone for the administrators to setup since they would have to keep things in sync in the app configuration and the actual server configuration.

Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
el_eduardo
Offline
Joined: 2011-04-22

So I found I can create system properties and use them in the connection pool using ${PROPERTYNAME}. I think this is the solution. Can you just confirm that this is how it can be done?

Thanks!