You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Do...@dot.ca.gov on 2003/07/29 22:37:01 UTC
DB Write Access Problem with Tomcat JNDI
Has anyone run into a problem with acquiring write access to a db using the
jndi setup with tomcat 4.1.24.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
Everything works beautifully except that I can't write to my Oracle 9 db. I
was able to write without a problem using the Struts DBCP BasicDataSource.
I don't see any parameters to set in the ResourceParams having to do with
read/write/transactions/autocommit
I've tried all permutations of setAutoCommit(true) and setAutoCommit(false)
and commit(). The setReadOnly(false) fails to actually set this property --
which is the only clue I can find -- thanks much
System.out.println("AutoCommit is set to " + cn.getAutoCommit());
System.out.println("ReadOnly is set to " + cn.getAutoCommit());
cn.setAutoCommit(true);
cn.setReadOnly(false);
System.out.println("AutoCommit is set to " + cn.getAutoCommit());
System.out.println("ReadOnly is set to " + cn.getAutoCommit());
Results of the above:
AutoCommit is set to true
ReadOnly is set to true
AutoCommit is set to true
ReadOnly is set to true
My web.xml:
<resource-ref>
<description>Oracle Datasource</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
My server.xml:
<Context path="/scmn" docBase="scmn"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_scmn_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/scmn" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/scmn">
<!-- Connection Pool -->
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Class name for Oracle JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<!-- Oracle JDBC url -->
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@localhost:1521:mn</value>
</parameter>
<parameter>
<name>username</name>
<value>mn</value>
</parameter>
<parameter>
<name>password</name>
<value>mn</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to
handle
all of your db connections. Set to 0 for no limit. -->
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in
pool.
Set to 0 for no limit. -->
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become
available
in ms, in this example 10 seconds. An Exception is
thrown if
this timeout is exceeded. Set to -1 to wait
indefinitely. -->
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org