Subject | Re: [IB-Java] Using Blobs in Type 4 driver |
---|---|
Author | David Jencks |
Post date | 2002-01-29T03:45:07Z |
How slow is it if you explicitly manage connections?
(I recommend using the non-jdbc but jca like
import javax.resource.cci.LocalTransaction;
LocalTransaction lt = ((FBConnection)conn).getLocalTransaction();
lt.begin();
(do work)
lt.commit();
)
I don't suppose I could talk you into writing this example as a junit test
we could add? (maybe you could fail if closing took more than 100 ms or
so).
david jencks.
(I recommend using the non-jdbc but jca like
import javax.resource.cci.LocalTransaction;
LocalTransaction lt = ((FBConnection)conn).getLocalTransaction();
lt.begin();
(do work)
lt.commit();
)
I don't suppose I could talk you into writing this example as a junit test
we could add? (maybe you could fail if closing took more than 100 ms or
so).
david jencks.
On 2002.01.28 19:04:39 -0500 Kenneth Foo wrote:
> Hi...
>
> The driver is faster now. Slowness was probably due to the debugging
> information that
> was generated under the debugging IDE. :)
>
> But I'm still having problem closing the connection (I did another post
> previously, but no answers).
> Basically, if I do many inserts (say, 100), closing the connection takes
> very long (80-100 seconds).
> It gets much much longer if I do more inserts.
>
> I did a trace through the code, and found that the code "paused" during
> the
> following stack trace.
>
> FBManagedConnection.notify
> FBStandAloneConnectionmanager.connectionClosed
> FBManagedConnection.destroy
> FBManagedConnectionFactory.releaseDbHandle
> GDS_Impl.isc_detach_database
> GDS_Impl.receiveResponse
> GDS_Impl.readOperation
> GDS_Impl.nextOperation (long pause here during db.in.readInt() )
>
>
> My code is as follows. Pretty much standard code to delete items from a
> table,
> and perform simple inserts.
>
> import java.sql.*;
> import org.firebirdsql.jdbc.*;
>
> public class TestFB {
>
> public TestFB() {
> }
>
> public static void main (String args[]) {
>
> try {
> Class.forName("org.firebirdsql.jdbc.FBDriver");
> Connection con =
> DriverManager.getConnection("jdbc:firebirdsql:localhost:x:/db/ncsdb.gdb",
> "SYSDBA", "masterkey");
> con.setAutoCommit(true);
> Statement statement = con.createStatement();
> statement.executeUpdate("DELETE FROM MESSAGES WHERE ID>=1000
> AND FOLDER_ID=999;");
>
> PreparedStatement ps = con.prepareStatement("INSERT INTO
> MESSAGES (ID,FOLDER_ID) VALUES(?,?);");
> con.setAutoCommit(true);
>
> long l1 = System.currentTimeMillis();
> for (int v = 0; v<1000; v++) {
> ps.clearParameters();
> ps.setLong(1, 1000+v);
> ps.setLong(2, 999);
> ps.executeUpdate();
> }
>
> System.out.println("FINISHED INSERT...");
>
> ps.close();
>
> long l2 = System.currentTimeMillis();
> System.out.println(l2-l1);
>
> System.out.println("CLOSING CONNECTION...");
>
> con.close();
>
> long l3 = System.currentTimeMillis();
> System.out.println(l3-l2);
>
> System.out.println("DONE!");
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
>
> }
>
>
> Anybody else experiencing such problems?
> I'm running the latest Firebird RC2 under Win2k,
> and running JDK 1.3.1_02.
>
> Thanks!
>
> Regards
> Kenneth
>
>
>
> ----- Original Message -----
> From: "David Jencks" <davidjencks@...>
> To: <IB-Java@yahoogroups.com>
> Sent: Tuesday, January 29, 2002 4:18 AM
> Subject: Re: [IB-Java] Using Blobs in Type 4 driver
>
>
> > On 2002.01.21 20:00:05 -0500 Kenneth Foo wrote:
> > > Hi...
> > >
> > > I just downloaded the Firbird JDBC Type 4 driver from CVS.
> > > Seems pretty good (anything that doesn't have that funny
> > > connection error in interclient is good)....
> > > ...except that I'm having trouble using Blobs.
> > >
> > > Any sample code to show how this is done? (Storing and retrieving)
> >
> > There is some example code in the tests. If you are interested, I made
> it
> > so you can create a blob object and then write into it, counter to the
> > spec.
> > >
> > > Another question:
> > > Is the Type 4 driver supposed to be much slower than interclient?
> > > I did some tests quite some time back, and found it to be crawling
> > > compared
> > > to Interclient. I wanted to fall back to Interclient for the time
> being,
> > > but
> > > it's connection error bug is killing me.
> >
> > Alejandro changed some buffer sizes that should have considerably
> speeded
> > up the new driver. Is it still slower than interclient?
> >
> > david jencks
> > >
> > > Thanks!!
> > >
> > >
> > > Regards
> > > Kenneth
> > >
> > >
> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > > <HTML><HEAD>
> > > <META content="text/html; charset=iso-8859-1"
> http-equiv=Content-Type>
> > > <META content="MSHTML 5.00.3315.2870" name=GENERATOR>
> > > <STYLE></STYLE>
> > > </HEAD>
> > > <BODY bgColor=#ffffff>
> > >
> > >
> > > <DIV><FONT face=Arial size=2>Hi...</FONT></DIV>
> > > <DIV> </DIV>
> > > <DIV><FONT face=Arial size=2>I just downloaded the Firbird JDBC Type
> 4
> > > driver
> > > from CVS.</FONT></DIV>
> > > <DIV><FONT face=Arial size=2>Seems pretty good (anything that doesn't
> > > have that
> > > funny</FONT></DIV>
> > > <DIV><FONT face=Arial size=2>connection error in interclient is
> > > good).... </FONT></DIV>
> > > <DIV><FONT face=Arial size=2>...e</FONT><FONT face=Arial size=2>xcept
> > > that I'm
> > > having trouble using Blobs.</FONT></DIV>
> > > <DIV> </DIV>
> > > <DIV><FONT face=Arial size=2>Any sample code to show how this is
> done?
> > > (Storing
> > > and retrieving)</FONT></DIV>
> > > <DIV>
> > > <DIV> </DIV>
> > > <DIV><FONT face=Arial size=2>Another question:</FONT></DIV>
> > > <DIV><FONT face=Arial size=2>Is the Type 4 driver supposed to be much
> > > slower
> > > than interclient?</FONT></DIV>
> > > <DIV><FONT face=Arial size=2>I did some tests quite some time back,
> and
> > > found it
> > > to be crawling compared</FONT></DIV>
> > > <DIV><FONT face=Arial size=2>to Interclient. I wanted to fall back to
> > > Interclient for the time being, but </FONT></DIV>
> > > <DIV><FONT face=Arial size=2>it's connection error bug is killing me.
> > > </FONT></DIV>
> > > <DIV> </DIV>
> > > <DIV><FONT face=Arial size=2>Thanks!!</FONT></DIV>
> > > <DIV> </DIV>
> > > <DIV> </DIV>
> > > <DIV><FONT face=Arial size=2>Regards</FONT></DIV>
> > > <DIV><FONT face=Arial size=2>Kenneth</FONT></DIV></DIV>
> > > <DIV> </DIV>
> > >
> > > <br>
> > > <tt>
> > > To unsubscribe from this group, send an email to:<BR>
> > > IB-Java-unsubscribe@egroups.com<BR>
> > > <BR>
> > > </tt>
> > > <br>
> > >
> > > <br>
> > > <tt>Your use of Yahoo! Groups is subject to the <a
> > > href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of
> > > Service</a>.</tt>
> > > </br>
> > >
> > > </BODY></HTML>
> > >
> >
> >
> > To unsubscribe from this group, send an email to:
> > IB-Java-unsubscribe@egroups.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
> To unsubscribe from this group, send an email to:
> IB-Java-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>