OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
RE: database Questions

From: Dittmar, Daniel (daniel.dittmarsap.com)
Date: Fri Jul 04 2003 - 11:44:48 CDT


> I am new to database and its concepts and I have few
> questions in implemeting my program. I have a program
> which reads an ascii file and updates into the
> corresponding table in the database. This works fine.
> Now I need to use threads ( i use java) where each
> thread reads one Ascii file( I have synchronized the
> reading of the ascii file) and updates into the
> database concurrently. Is there any methods or
> statements I need to add into the program or Is there
> anything I need to set in sapdb when I use thread.
> What state do I need to set the conn.autocommit? Also
> the Ascii files are independent of each other.

- use one Connection per thread (the user must have been created as NOT EXCLUSIVE). Only one .execute () can be active on a Connection so you wouldn't gain much if there is only one Connection

- if you want to maximize performance:
  * set autocommit to false (but do an explicit
    Connection.commit () every few hundred INSERTs
  * use PrepapredStatements and addBatch, executeBatch

Daniel Dittmar

--
Daniel Dittmar
SAP DB, SAP Labs Berlin
daniel.dittmarsap.com
http://www.sapdb.org/
_______________________________________________
sapdb.general mailing list
sapdb.generallistserv.sap.com
http://listserv.sap.com/mailman/listinfo/sapdb.general