Hi,
I have a strange problem while using the JDBC drivers. I
connected to an Oracle database using the ODBC bridge,
wrote 10000 records into a table. It took around 13 seconds
(auto-commit was set off). When I repeated the same code
with a Oracle-JDBC driver, it took around 10 seconds!!
Surely the Oracle-JDBC driver should have taken less time.
I am enclosing the code. Can anybody tell me where I could
have gone wrong?
---------Code begins here-----------------
import java.sql.*;
public class DBTest
{
private long lngDif;
private java.util.Date dtStart,dtStop;
private Connection conOra;
private PreparedStatement pst;
public DBTest()
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conOra =
DriverManager.getConnection("jdbc:oracle:thin:@infotech:1521:infotech","scott","tiger");
conOra.setAutoCommit(false);
pst = conOra.prepareStatement("insert into Test
values(?,?)");
dtStart = new java.util.Date();
System.out.println(dtStart);
for (int a=0; a<9999; a++)
{
pst.setInt(1,a);
pst.setString(2,String.valueOf(a));
pst.executeUpdate();
}
dtStop = new java.util.Date();
lngDif = dtStop.getTime() - dtStart.getTime();
System.out.println("Difference in time in Oracle is
"+lngDif/1000+" seconds");
}
catch(Exception se)
{
System.out.println(se);
}
}
public static void main(String args[])
{
DBTest dbt = new DBTest();
}
}
---------Code ends here-----------------
Thanks and bye,
Arun Jayaprakash.
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html