MySQL Forums
Forum List  »  Quality Assurance

jdni URL ignored on tomcat 6
Posted by: andrew davidson
Date: September 06, 2011 12:25PM

Hi

I have a java servlet that needs to assess two different databases running on the same server. The databases that I want to connect to are named

"drupal_arpae0" and "drupal_arpae1". The server also has a database name "drupal"

based on the data returned it appears I always connect to "drupal" Is "_" some sort of magic or meta charter? If my databases do not use "_" in their names, I am able to connect with out any problems

Any idea what I am doing wrong? (I have test case I can send that demonstrates this problem/bug)

Is there any easy way to rename the databases?

Thanks

Andy

Here is part of my context.xml file

<Context debug="5" reloadable="true" crossContext="true">


<Resource name="jdbc/drupal_arpae0" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="xxx" password="xxx" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/drupal_arpae0?autoReconnect=true"

validationQuery="Select 1"
testOnBorrow="true"

removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
/>


<Resource name="jdbc/drupal_arpae1" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="xxx" password="xxx" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/drupal_arpae1?autoReconnect=true"

validationQuery="Select 1"
testOnBorrow="true"

removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
/>


Here are my web.xml entries

<resource-ref>

<res-ref-name>jdbc/drupal_arpae0</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<resource-ref>
<res-ref-name>jdbc/drupal_arpae1</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

here is how I init my data sources

Context initContext = new InitialContext();
lookup = "java:comp/env/jdbc/drupal_arpae0";
applicationCalculatorDataSource = (DataSource) initContext.lookup(lookup);

lookup = "java:comp/env/jdbc/drupal_arpae1";
kidgoDataSource = (DataSource) initContext.lookup(lookup);

Options: ReplyQuote


Subject
Views
Written By
Posted
jdni URL ignored on tomcat 6
2115
September 06, 2011 12:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.