db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: Derby not committing in tomcat
Date Sun, 26 Oct 2008 17:25:13 GMT
k74yeung-derby@yahoo.com.sg wrote:
> Hi all
> I've read all documentations and followed all there is
> to follow. I got Derby DB running in network
> server mode, copied derbyclient.jar to tomcat's
> common/lib, copied JOTM to the same and in my servlet
> started a JTA UserTransaction and got a DataSource
> from JNDI.
> However, data I inserted to the DB didn't get
> committed, despite calling tx.commit(). All logging
> and debug indicate a successful commit.

Hello Kevin,

Does your logging involve JDBC driver statement logging?
It requires you to set some options on the client side. Another, and 
easier option, is to enable statement logging in the Derby network server.
All you need to do is add "derby.language.logStatementText=true" to your 
derby.properties (or specify it at the Java commend line when starting 
the network server). You should then be able to confirm the commit on 
the server by looking in derby.log.

If that logging indicate a commit and you still can't find the data, are 
you sure you are booting/accessing the same database? It's not stored in 
a temp filesystem or something?

I haven't looked at your other questions yet (my Tomcat experience is 
very limited).


> One thing I noticed is that the DataSource class is
> "org.apache.tomcat.dbcp.dbcp.BasicDataSource" and the
> Connection class is
> "org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper".
> I think they should be from org.derby.jdbc but I am
> not sure. Is there a configuration where I tell tomcat
> to use derby's own DataSourceFactory to create an XA
> DataSource?
> I've attached various tomcat configuration files and
> would be grateful if someone would give me a hand.
> Thanks, Kevin.
> web.xml, amongst other things I have:
> <resource-ref>
>       <description>DB Connection</description>
>       <res-ref-name>jdbc/CDDB</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
> </resource-ref>
> context.xml, this one goes into
> webapps/carpediem/META-INF:
> <Context path="/carpediem" docBase="carpediem"
>          debug="5" reloadable="true"
> crossContext="true">
>   <Resource name="jdbc/CDDB" auth="Container"
> type="javax.sql.DataSource"
>             maxActive="5" maxIdle="30" maxWait="10000"
>             username="cd" password="cd"
> driverClassName="org.apache.derby.jdbc.ClientDriver"
>             defaultAutoCommit="false"
> defaultTransactionIsolation="READ_COMMITTED"
>             url="jdbc:derby://localhost:1527/CDDB"/>
>   <Transaction name="UserTransaction" auth="Container"
> type="javax.transaction.UserTransaction"
> factory="org.objectweb.jotm.UserTransactionFactory"
>                jotm.timeout="60"/>
> </Context>
>       New Email addresses available on Yahoo!
> Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. 
> Hurry before someone else does!
> http://mail.promotions.yahoo.com/newdomains/sg/

View raw message