db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rosengartner, Donald [CC]" <Donald.Rosengart...@mail.sprint.com>
Subject Mainframe Connection
Date Fri, 12 Sep 2003 18:50:47 GMT
I'm having problems connecting Torque(3.0.2rc2 and 3.1) to an OS390 IBM DB2 using JDBC driver.
I have gotten Tomcat to start without complaint, but get exception when trying to access the
connection pool. 

org.apache.jasper.JasperException: Connection object was null. This could be due to a misconfiguration
of the DataSourceFactory. Check the logs and Torque.properties to better determine the cause.
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
*
*
*
----- Root Cause -----
java.lang.NullPointerException: Connection object was null. This could be due to a misconfiguration
of the DataSourceFactory. Check the logs and Torque.properties to better determine the cause.
	at org.apache.torque.util.Transaction.rollback(Transaction.java:179)
	at org.apache.torque.util.Transaction.safeRollback(Transaction.java:221)
	at com.sprint.nsd.ceas.datapack.BaseTblScty.save(BaseTblScty.java:819)
	at com.sprint.nsd.ceas.datapack.BaseTblScty.save(BaseTblScty.java:794)
*
*
*

I am able to connect from within a servlet with the standard hardcoding of my parameters without
Torque(url/username/etc).. meaning driver is ok for Torque(??)

I have seen in the docs and newslist that many people have used an implementation of Adapter
class. Can someone share how this is implemented? Also, I'm concerned about the format of
Torque generated SQL; I need: Select * from Schema.TableName where...  

One potential problem in getting my pool/datasource to work may be in the validation query
(or) format of the SQL as mentioned above. I have a working implementation of MySQL which
omitted the "validation query" parameter from the Torque.properties file. Is this required
for DB2?

Our team is in limbo until we get this obstacle overcome. Meanwhile, we're attempting to hack
the Torque source to use a working connection pool generated by weblogic. Torque.init() throwing
exception in this case.

We have attempted this with Tomcat 4, and Weblogic704. Our wish is to have the servlet container
generate the pool and Torque retrieve connections. Following is sample config.

**************Web.xml******************
<servlet>
    <servlet-name>initServlet</servlet-name>
    <servlet-class>com.sprint.nsd.ceas.control.InitServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/conf/Torque.properties</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
*
*
*
<resource-ref>
    <description>
    Resource reference to a factory for java.sql.Connection
    instances that may be used for talking to a particular
    database that is configured in the server.xml file.
  </description>
    <res-ref-name>
    jdbc/db2d
  </res-ref-name>
    <res-type>
    org.apache.torque.dsfactory.TorqueDataSourceFactory
  </res-type>
    <res-auth>
    Container
  </res-auth>
  </resource-ref>

*****************Server.xml****************
<Context path="/db2d" docBase="ceas" debug="0" reloadable="true" crossContext="true">
	          <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_ceas_log."
suffix=".txt" timestamp="true"/>
	          
	          <Resource name="jdbc/db2d" auth="SERVLET" type="org.apache.torque.dsfactory.TorqueDataSourceFactory"/>
	          <ResourceParams name="jdbc/db2d">
	            <parameter><name>dataSourceName</name><value>java:comp/env/jdbc/db2d</value></parameter>
		  </ResourceParams>
</Context>

************Torque.properties****************
## Using torque's old pool
torque.dsfactory.db2d.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory
torque.dsfactory.db2d.pool.defaultMaxConnections=30
torque.dsfactory.db2d.pool.maxExpiryTime=3600
torque.dsfactory.db2d.pool.connectionWaitTimeout=10
torque.dsfactory.db2d.connection.driver = COM.ibm.db2.jdbc.app.DB2Driver
torque.dsfactory.db2d.connection.url = jdbc:db2://sa05.corp.sprint.com:port/db2d
#torque.dsfactory.db2d.connection.url = jdbc:db2://ipAddress:port/db2d
#  next one assumes the PC running tomcat knows what alias db2d means; not sure if this is
doable
#torque.dsfactory.db2d.connection.url = jdbc:db2:db2d  
torque.dsfactory.db2d.connection.user = username
torque.dsfactory.db2d.connection.password = password



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message