ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Zeitz" <carsten.ze...@gmx.de>
Subject Problem inserting many rows
Date Mon, 16 Oct 2006 20:46:02 GMT
Hi,

these are my first steps using iBATIS. I'd like to use it in an application to write incoming
messages to a MySQL database. I just make a simple test to check the performance. I use a
loop to insert 2000 message objects. The result: It inserts 10, then waits, insert another
10, waits, ... and after 32 message it hangs up.

Now where is my problem ???

Here my configuration:

<sqlMapConfig>

 	<properties resource="etc/database.properties"/>

  	<transactionManager type="JDBC">
    	<dataSource type="SIMPLE">
	      	<property value="${driver}" name="JDBC.Driver"/>
	      	<property value="${url}" name="JDBC.ConnectionURL"/>
	  	<property value="${username}" name="JDBC.Username"/>
	    	<property value="${password}" name="JDBC.Password"/>
		</dataSource>
  	</transactionManager>

  	<sqlMap resource="etc/Message.xml"/>

</sqlMapConfig>

<sqlMap namespace="Message">
  	<typeAlias alias="Message" type="Message"/>

  	<insert id="insertMessage" parameterClass="Message">
    		INSERT INTO messages ( timeStamp, ip, text )
    		VALUES ( #timeStamp#, #ip#, #text# )
  	</insert>

</sqlMap>


Reader reader = Resources.getResourceAsReader("etc/ibatis-config.xml");
SqlMapClient sqlmap = SqlMapClientBuilder.buildSqlMapClient(reader);
			
Message tMessage = new Message();

for( int i = 0; i < 2000; i++ )
{
	sqlmap.startTransaction();
	sqlmap.insert("insertMessage", tMessage );
	System.out.println("Insert " + i);
	sqlmap.commitTransaction();
}


I hope you can help me!

Thanks a lot,
Carsten


-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

Mime
View raw message