[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-torque-user
Subject:    AW: Auto Commit + Transaction Problems
From:       "Ferruh Zamangoer" <ferruh.zamangoer () gistec-online ! de>
Date:       2004-12-21 10:14:01
Message-ID: CIEJIFELLAJDADFICPNPEEMLCAAA.ferruh.zamangoer () gistec-online ! de
[Download RAW message or body]

Hi,

in most cases I use the save method without a connection object. I have some
methods wehere I use executeStatement and executeQuery.  A set transaction
Command i've never used in my code.

Do you mean with the runtime configuration the torque.properties ?

I have the following setting in Torque properties:

torque.applicationRoot = C:\torque-gen-3.1

log4j.rootLogger = ALL, default

log4j.appender.default = org.apache.log4j.FileAppender
log4j.appender.default.file = C:/Temp/torque_log.txt
log4j.appender.default.layout = org.apache.log4j.PatternLayout
log4j.appender.default.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.default.append = false

torque.database.default = ingeo
torque.database.ingeo.driver = oracle.jdbc.driver.OracleDriver
torque.database.ingeo.url = jdbc:oracle:thin:@xxx.xx.xxx.xx:xxx:ingeo
torque.database.ingeo.username = advmis
torque.database.ingeo.password = advmis
torque.database.ingeo.adapter = oracle

torque.dsfactory.ingeo.factory=org.apache.torque.dsfactory.TorqueDataSourceF
actory
torque.dsfactory.ingeo.pool.defaultMaxConnections 
torque.dsfactory.ingeo.pool.maxExpiryTime600
torque.dsfactory.ingeo.pool.connectionWaitTimeout
torque.dsfactory.ingeo.connection.driver = oracle.jdbc.driver.OracleDriver
torque.dsfactory.ingeo.connection.url jdbc:oracle:thin:@xxx.xx.xxx.xx:xxx:ingeo
torque.dsfactory.ingeo.connection.user = advmis
torque.dsfactory.ingeo.connection.password = advmis


And this is one of the overidden Methods where I'am using executeStatements
and executeQuery:

public static void doInsert(PtFreetext obj)
			throws TorqueException
		{
			DBOracleAdapter db = new DBOracleAdapter();

			String sqlSequenceQuery = db.getIDMethodSQL("GISTEC_PT_FREETEXT_SEQ");

			List list = executeQuery(sqlSequenceQuery); // Here is the Execption
thrown.

			Record primaryKey = new Record();

			if(list.size()!=0)
			{
				primaryKey = (Record)list.get(0);
			}

			String pk = primaryKey.toString();

			int begin = pk.indexOf("'");
			int end = pk.lastIndexOf("'");
			String uniquePrimaryKey = pk.substring(begin+1, end);

			obj.setIdfreetext(new Integer(Integer.parseInt(uniquePrimaryKey)));

			executeStatement("INSERT INTO PT_FREETEXT values("+uniquePrimaryKey+")");


		}


Thanks for any help.

Regards
Ferruh


Hi,

Some pools can test connections before they give it to the end user (in
this case Torque). This is done by executing a simple query like "select
sysdate from dual". If the connections are not auto commit, this is the
first query in the transaction, and it is not possible to use any "set
transaction..." commands afterwards.

do you only use the methods (save()...)without connection, or do you also
use methods that need a connection (save(connection)...) or custom queries
?
What Pool are you using (see your runtime configuration) ?

   Thomas

zamangoer@gistec-online.de schrieb am 20.12.2004 23:18:34:

> Hi,
>
> in my code i never use a commit/rollback. If I'm not mistaken Torque
makes
> a commit/rollback internally when method save() is called???? Can you
> explain a little bit more what you mean with testOnBorrow??
>
> Ferruh
>
> >
> > Hi,
> >
> > One reason could be that you do not commit /rollback a connection
before
> > giving it back to the pool, and the pool does not do a commit/rollback,
> > and
> > you fetch the connection again and the pool tries to set transaction
> > isolation or something similar.
> > Another reason might be that are you explicitly using any "set
Transaction
> > ..." statement, and it is not the first statement in the transaction.
This
> > can happen e.g. if you use testOnBorrow = true.
> >
> >    Thomas
> >
> > "Ferruh Zamangoer" <ferruh.zamangoer@gistec-online.de> schrieb am
> > 20.12.2004 18:31:12:
> >
> >> Hi NG,
> >>
> >> is there any way in Torque to turn on auto commit? We have the problem
> > that
> >> we become the following Exception, when we want to insert a dataset
into
> > the
> >> database.
> >>
> >> java.sql.SQLException: ORA-01453: SET TRANSACTION muss erste Anweisung
> > der
> >> Transaktion sein
> ..


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


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic