I have fixed the problem.

It was very simple in the end but took a little time for me to figure out.

The problem was the fact that I was using one of the DB connections from the
JBoss managed pool. This pool of connections was under the control of a
transaction manager and therefore any operations do not necessarily commit
straight away.

The two choices I had were to setup a second datasource, not under
transaction management, or to run the command:
connection.getConnection().commit() before I closed the connection.

A very simple solution, and probably highlighting my lack of experiences
with databases! ;-)

I might implement the first option at a later date, but as always, there's
other work to be done!

All the best,

Tim 

> 
> 
>  Hi,
> 
> I don't know if anyone here has used jbunit 
> (http://dbunit.sourceforge.net/)
> with JBoss but if anyone has I'd appreciate some help.
> 
> I am trying a simple operation to populate the database with 
> data from the
> jbunit dataset from within a testcase (running within jboss, 
> using cactus).
> 
> Initially I found that it would run but no data would appear 
> in the DB.
> Looking at the DB logs I saw that all the operations were 
> being roled back,
> but no errors were appearing from my testcase. I was using a 
> DB connection
> from the Jboss pool (PostgresDS).
> 
> I then tried it again but this time making a database 
> connection manually.
> This worked okay. I have since tried several different 
> methods and have
> found the following:
> - It'll work fine when using a database connection manually created.
> - It'll fail when trying to use a DB connection from JBoss's Postgres
> datasource pool.
> 
> Has anyone used jbunit before and would they have any advice? 
> I am assuming
> it's a problem caused by the fact that an "external" (if you 
> could call it
> that) entity is trying to use JBoss DB connections.
> 
> More information can be found from my post to the jbunit mailing list:
> http://www.geocrawler.com/lists/3/SourceForge/20449/0/8463589/
> and a follow up at:
> http://www.geocrawler.com/lists/3/SourceForge/20449/0/8471840/
> 
> I am currently trying to change the current commit option 
> used by JBoss but
> this is the first time I have really looked at this, so it'll 
> take me a
> little while to figure it out.
> 
> Any ideas, advice would be appreciated!
> 
> All the best,
> 
> Tim
> 
> 
> 

Attachment: msg15551/bin00000.bin
Description: application/ms-tnef

Reply via email to