wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Configuring Multiple Datasources w/ Jboss 3.2.x Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Configuring Multiple Datasources w/ Jboss 3.2.x" Watch "Configuring Multiple Datasources w/ Jboss 3.2.x" New topic
Author

Configuring Multiple Datasources w/ Jboss 3.2.x

Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
Hi, I'm attempting to run JBoss with 2 Ingres databases AND the included Hypersonic database (for a total of 3). Currently, I have the Hypersonic database bound to the JNDI name DefaultDS, and the other Ingres databases to something else.
It seems as if I can only see one of the databases at one time. I have a *-ds.xml file for each DB, I have tried modifying the login-config.xml to have JBoss "see" each database, and no matter what I try, it seems as if I can only access one DB at a time, and it happens to be the one that is bound to "DefaultDS".
Any ideas? Thanks!
norman richards
Author
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
Could you clarify what you mean by "see" your datasource. There's no way to understand what you mean when you say you can't "see" it.
You can use the jmx console to look up and make sure the datasources are getting registered properly. Assuming they are, let's look at your login-config.xml. I assume you are trying to create an application-policy using one of the the database login modules, right? Did you specify they jsJndiName as a module-option?
If you have specified it, are you specifying your security domain in your jboss.xml and/or your jboss-web.xml?
Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
What I mean when I say "see" is that the other two databases don't seem to be able to be accessed. For example, I can name 1 of them DefaultDS, and I can access that fine, but then I can't access the other 2. And if I name another one DefaultDS, I can access that one, but again, the other 2 cannot be accessed.
As a more clear-cut example, the application uses the HyperSonic database packaged with JBoss to create and store a session ID, and then another Ingres database to check login information. If I bind the HyperSonic database to "DefaultDS", I create the session ID just fine, but then I cannot login, and if I name the other database "DefaultDS", I can login, but I get errors trying to create a sessionID.
I'm not sure what else I need to do at this point. I'm pretty sure my *-ds.xml files are fine, and I've added entries in the login.xml as well. I have a feeling I'm just missing something quite obvious, but since I can't find any documentation regarding setting up multiple database for JBoss 3.2, I'm a little lost.
Thanks and any help would be greatly appreciated.
Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
Here's a copy of a post I made on the JBoss forums on the JBoss website. Unfortunately, no one has decided to aid me in my time of need .

Hi, I'm attempting to configure JBoss 3.2.3 to recognize 3 databases...the packaged Hypersonic one and 2 Ingres databases. I currently have the default hsdqldb-ds.xml, as well as separate -ds.xml files for each Ingres database in the server/default/deploy directory.
I have managed to start JBoss with no errors, however, it seems as if the application can only access the DefaultDS, which is the Hypersonic database. For example, one of the Ingres databases is used to hold User information, and if I change the JNDI name for it to DefaultDS, I can access that database, but none of the other 3. And the Hypersonic one handles session information, so if that is DefaultDS, I can generate a sessionId with no problem, but then I can't login! I have looked around, and have seen mention of adding things to the standardjbosscmp-jdbc.xml file as well as adding things to the login-config.xml file.
If someone could please point me in the right direction in what I need to do so that the application will be able to "see" all three databases. Note that this is something being ported from JBoss 2.4.3 so pretty much everything is already in place and working, just the configuration of JBoss 3.2.3 needs to be done.
Here is an example of what I have in the Ingres -ds.xml files (skipped the hsqldb-ds.xml one since I have no changed it in any way from the default configuration it came with the distribution...both Ingres files are very similar except for the jndi-name):
<?xml version="1.0" encoding="UTF-8"?>

<local-tx-datasource>
<jndi-name>UserDB</jndi-name>
<connection-url>jdbc:edbc://DATABASEINFO</connection-url>
<user-name>USER</user-name>
PASSWORD
<driver-class>ca.edbc.jdbc.EdbcDriver</driver-class>
<min-pool-size>0</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>1200000</idle-timeout-minutes>
</local-tx-datasource>

Thanks! Any help would be appreciated.
Eric

Oh, and I am NOT using any CMP, so I guess modifying the jbosscmp-jdbc.xml files would not be necessary?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configuring Multiple Datasources w/ Jboss 3.2.x
 
Similar Threads
Postgres using hypersonic mappings?
problem in setting mySql as default database server
Configuring a Postgres Datasource
JAAS DatabaseServerLoginModule
problems with Session.save()