db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrab <michele.raba...@nscorp.com>
Subject Torque 3.1.1 - change database url based on env (QA, TEST, etc.)
Date Mon, 26 Sep 2011 20:05:13 GMT

I would like to be able to change the url depending on the environment. 
After making the changes below and restarting tomcat, I'm getting the
following error that I need help with: 

ERROR org.apache.torque.oid.IDBroker - Could not open a connection to the
database inventory_test 
java.lang.NullPointerException 



Changes made: 

changed /tomcat/webapps/inventory/WEB-INF/conf/torque.properties... now
contains only the following properties, 

torque.applicationRoot = . 
torque.idbroker.cleverquantity = true 
torque.idbroker.prefetch = true 
torque.idbroker.usenewconnection = true 
torque.database.default = inventory 
torque.database.inventory.adapter =     mysql 
torque.dsfactory.inventory.factory =   
org.apache.torque.dsfactory.JndiDataSourceFactory 
torque.dsfactory.inventory.jndi.path=jdbc/inventory 

changed /tomcat/conf/server.xml...GlobalNamingResources looks like this, 

  <GlobalNamingResources> 

    <!-- Test entry for demonstration purposes --> 
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/> 

    <!-- Editable user database that can also be used by 
         UserDatabaseRealm to authenticate users --> 
    <Resource name="UserDatabase" auth="Container" 
              type="org.apache.catalina.UserDatabase" 
       description="User database that can be updated and saved" 
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory" 
          pathname="conf/tomcat-users.xml" /> 

     <!-- Connection to 'inventory_test' --> 
     <Resource name="jdbc/inventory_test" 
       auth="Container" 
       type="javax.sql.DataSource" 
       driverClassName="org.gjt.mm.mysql.Driver" 
       url="jdbc:mysql://Inventorymysqltest.ns.com/inventory_test" 
       user="user" 
       password="password" 
       /> 


  </GlobalNamingResources> 

changed /tomcat/conf/context.xml... added this line to the <Context>
section, 

    <ResourceLink global="jdbc/inventory_test" name="jdbc/inventory"
type="javax.sql.DataSource"/> 


   (Thanks Thomas for your help.  I am unable to post in the other forum so
I'm giving this one a try.)


Thanks! 
Michele

-- 
View this message in context: http://old.nabble.com/Torque-3.1.1---change-database-url-based-on-env-%28QA%2C-TEST%2C-etc.%29-tp32503962p32503962.html
Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message