Subject Re: [IB-Java] Using Blobs in Type 4 driver
Author Kenneth Foo
Hi David

The peculiar problem seem to happen only to this one particular database
file of mine.
I tried working on a fresh new database file and everything works as zippy
as it should.

Btw, I'm unable to reproduce the problem, as I've accidentally overwritten
the database file while writing the unit test code. :(

Anyway, not sure whether it's still useful, but attached is the
TestBatchInsert unit test code.

Btw, how come FBConnection.commit() and FBConnection.rollback() both have
a commented getLocalTransaction().begin(); line?

Since they're commented, I'm unable to perform repeated Blob inserts using
the same
prepared statement, unless I explicitly control the transaction (begin and
commit) as
used in the test code.


Regards
Kenneth
kenneth@...


"David Jencks" <davidjencks@...> wrote in message
news:20020128225207.O19825@......
> On 2002.01.28 22:45:07 -0500 David Jencks wrote:
> > How slow is it if you explicitly manage connections?
>
> Need to proofread. manage __transactions__?
> >
> > (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/
> > >
> > >
> > >
> > >
> >
> >
> > 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/
>
>
>


begin 666 TestBatchInsert.java
M:6UP;W)T(&IA=F$N<W%L+BH["FEM<&]R="!J=6YI="YF<F%M97=O<FLN*CL*
M:6UP;W)T(&]R9RYF:7)E8FER9'-Q;"YJ9&)C+BH["@IP=6)L:6,@8VQA<W,@
M5&5S=$)A=&-H26YS97)T(&5X=&5N9',@0F%S949"5&5S="!["B @(" *(" @
M('!R:79A=&4@<W1A=&EC(&9I;F%L(&EN="!-05A?0TQ/4T5?5$E-12 ](#(P
M,#L@("\O,C P;7,@;6%X(&9O<B!C;&]S:6YG(&-O;FYE8W1I;VX*(" @( H@
M(" @<'5B;&EC('-T871I8R!F:6YA;"!3=')I;F<@0U)%051%7U1%4U1?5$%"
M3$4@/0H@(" @(D-214%412!404),12!J9&)C7W1E<W0@*"(@*PH@(" @(B @
M('1E<W1?:6YT($E.5$5'15(@3D]4($Y53$P@4%))34%262!+15DL(BL*(" @
M("(@("!T97-T7W8Q($E.5$5'15(L(BL*(" @("(@("!T97-T7W8R(%9!4D-(
M05(H-C0I+"(K"B @(" B(" @=&5S=%]V,R!"3$]"(%-%1TU%3E0@4TE:12 Q
M,#(T(BL*(" @("(I.R(["B @(" *(" @('!U8FQI8R!S=&%T:6,@9FEN86P@
M4W1R:6YG($123U!?5$535%]404),12 ]"B @(" B1%)/4"!404),12!J9&)C
M7W1E<W0[(CL*(" @( H@(" @<'5B;&EC('-T871I8R!F:6YA;"!3=')I;F<@
M1$5,151%7U1%4U1?5$%"3$4@/0H@(" @(D1%3$5412!&4D]-(&ID8F-?=&5S
M=#LB.PH@(" @"B @("!P<FEV871E(&IA=F$N<W%L+D-O;FYE8W1I;VX@8V]N
M;F5C=&EO;CL*(" @( H@(" @"B @("!P=6)L:6,@5&5S=$)A=&-H26YS97)T
M*%-T<FEN9R!N86UE*2!["B @(" @(" @<W5P97(H;F%M92D["B @("!]"B @
M(" *(" @('!R;W1E8W1E9"!V;VED('-E=%5P*"D@=&AR;W=S($5X8V5P=&EO
M;B!["B @(" @(" @<W5P97(N<V5T57 H*3L*(" @(" @("!#;&%S<RYF;W).
M86UE*$9"1')I=F5R+F-L87-S+F=E=$YA;64H*2D["B @("!]"B @(" *(" @
M('!R;W1E8W1E9"!V;VED('1E87)$;W=N*"D@=&AR;W=S($5X8V5P=&EO;B![
M"B @(" @(" @=')Y('L*(" @(" @(" @(" @:68@*"%C;VYN96-T:6]N+F=E
M=$%U=&]#;VUM:70H*2D@>PH@(" @(" @(" @(" @(" @8V]N;F5C=&EO;BYC
M;VUM:70H*3L*(" @(" @(" @(" @?0H@(" @(" @('T*(" @(" @("!C871C
M:" H17AC97!T:6]N(&4I('L*(" @(" @(" @(" @+R]T:&5S92!M97-S86=E
M<R!A<F4@=&]O(&%N;F]Y:6YG+@H@(" @(" @(" @(" O+U-Y<W1E;2YO=70N
M<')I;G1L;B@B4&]S<VEB;&4@<')O8FQE;2!C;VUM:71T:6YG(&)E9F]R92!C
M;&]S92!O9B!C;VYN96-T:6]N+2T@<&]S<VEB;'D@;F]T(&$@<')O8FQE;2(I
M.PH@(" @(" @(" @(" O+R!E+G!R:6YT4W1A8VM4<F%C92@...@(" @(" @
M('T@+R\@96YD(&]F('1R>2UC871C: H@(" @(" @('-U<&5R+G1E87)$;W=N
M*"D["B @("!]"B @(" *(" @( H@(" @<'5B;&EC('-T871I8R!497-T('-U
M:71E*"D@>PH@(" @(" @(%1E<W13=6ET92!S=6ET92 ](&YE=R!497-T4W5I
M=&4H5&5S=$)A=&-H26YS97)T+F-L87-S*3L*(" @(" @("!R971U<FX@<W5I
M=&4["B @("!]"B @(" *(" @( H@(" @<'5B;&EC('9O:60@=&5S=$)A=&-H
M26YS97)T*"D@=&AR;W=S($5X8V5P=&EO;B!["B @(" @(" @=')Y>PH@(" @
M(" @(" @("!C;VYN96-T:6]N(#T@:F%V82YS<6PN1')I=F5R36%N86=E<BYG
M971#;VYN96-T:6]N*$1"7T12259%4E]54DPL($1"7TE.1D\I.PH@(" @(" @
M(" @(" *(" @(" @(" @(" @+R]0<F5P87)E('1E<W0@=&%B;&4*(" @(" @
M(" @(" @8V]N;F5C=&EO;BYS971!=71O0V]M;6ET*&9A;'-E*3L*(" @(" @
M(" @(" @4W1A=&5M96YT('-T871E;65N=" ](&-O;FYE8W1I;VXN8W)E871E
M4W1A=&5M96YT*"D["B @(" @(" @(" @('1R>2!["B @(" @(" @(" @(" @
M("!S=&%T96UE;G0N97AE8W5T92A$4D]07U1%4U1?5$%"3$4I.PH@(" @(" @
M(" @("!]"B @(" @(" @(" @(&-A=&-H("A%>&-E<'1I;VX@92D@>PH@(" @
M(" @(" @("!]"B @(" @(" @(" @('-T871E;65N="YE>&5C=71E57!D871E
M*$-214%415]415-47U1!0DQ%*3L*(" @(" @(" @(" @8V]N;F5C=&EO;BYC
M;VUM:70H*3L*"B @(" @(" @(" @( H@(" @(" @(" @(" O+V-O;FYE8W1I
M;VXN<V5T075T;T-O;6UI="AT<G5E*3L*(" @(" @(" @(" @4')E<&%R9613
M=&%T96UE;G0@<',@/2!C;VYN96-T:6]N+G!R97!A<F53=&%T96UE;G0H(DE.
M4T525"!)3E1/(&ID8F-?=&5S=" H=&5S=%]I;G0L=&5S=%]V,2QT97-T7W8R
M+'1E<W1?=C,I(%9!3%5%4R H/RP_+#\L/RD[(BD["@H@(" @(" @(" @("!C
M;VYN96-T:6]N+G-E=$%U=&]#;VUM:70H9F%L<V4I.PH@(" @(" @(" @(" *
M(" @(" @(" @(" @"B @(" @(" @(" @("\O8V]N;F5C=&EO;BYC;VUM:70H
M*3L*(" @(" @(" @(" @:F%V87@N<F5S;W5R8V4N8V-I+DQO8V%L5')A;G-A
M8W1I;VX@;'0@/2 H*$9"0V]N;F5C=&EO;BEC;VYN96-T:6]N*2YG971,;V-A
M;%1R86YS86-T:6]N*"D["B @(" @(" @(" @(&QT+F-O;6UI="@...*(" @
M(" @(" @(" @"B @(" @(" @(" @("\O4&5R9F]R;2!B871C:"!I;G-E<G0*
M(" @(" @(" @(" @9F]R("AI;G0@:3TP.R!I/#(P,#L@:2LK*2!["B @(" @
M(" @(" @(" @("!L="YB96=I;B@...@(" @(" @(" @(" @(" @<',N8VQE
M87)087)A;65T97)S*"D["B @(" @(" @(" @(" @("!P<RYS971);G0H,2P@
M:2D["B @(" @(" @(" @(" @("!P<RYS971);G0H,BP@:2D["B @(" @(" @
M(" @(" @("!P<RYS9713=')I;F<H,RP@(E1%4U1415-4(B K($EN=&5G97(N
M=&]3=')I;F<H:2DI.PH@(" @(" @(" @(" @(" @<',N<V5T0GET97,H-"P@
M;F5W(&)Y=&5;,3 P72D["B @(" @(" @(" @(" @("!P<RYE>&5C=71E57!D
M871E*"D["B @(" @(" @(" @(" @("!L="YC;VUM:70H*3L*+R\@(" @(" @
M(" @(" @(" @8V]N;F5C=&EO;BYC;VUM:70H*3L*+R\@(" @(" @(" @(" @
M(" @8V]N;F5C=&EO;BYS971!=71O0V]M;6ET*'1R=64I.PH@(" @(" @(" @
M("!]"B @(" @(" @(" @( H@(" @(" @(" @(" O+W-T871E;65N="YE>&5C
M=71E57!D871E*$123U!?5$535%]404),12D["B @(" @(" @(" @("\O8V]N
M;F5C=&EO;BYC;VUM:70H*3L*"B @(" @(" @(" @("\O5&EM92!C;VYN96-T
M:6]N(&-L;W-E"B @(" @(" @(" @(&QO;F<@=&EM93$@/2!3>7-T96TN8W5R
M<F5N=%1I;65-:6QL:7,H*3L*(" @(" @(" @(" @<',N8VQO<V4H*3L*(" @
M(" @(" @(" @8V]N;F5C=&EO;BYC;&]S92@...@(" @(" @(" @("!L;VYG
M('1I;64R(#T@4WES=&5M+F-U<G)E;G14:6UE36EL;&ES*"D["B @(" @(" @
M(" @(&%S<V5R=%1R=64H=&EM93(M=&EM93$@/#T@34%87T-,3U-%7U1)344I
M.R @("\O07-S97)T(&-L;W-E('1I;64*(" @(" @("!]"B @(" @(" @8V%T
M8V@H17AC97!T:6]N(&5X*2!["B @(" @(" @(" @(&5X+G!R:6YT4W1A8VM4
M<F%C92@...@(" @(" @(" @("!A<W-E<G14<G5E*&5X+F=E=$UE<W-A9V4H
M*2P@9F%L<V4I.PH@(" @(" @('T*(" @('T*"B @("!P=6)L:6,@<W1A=&EC
M('9O:60@;6%I;BA3=')I;F<@87)G<UM=*2!["B @(" @(" @:G5N:70N=&5X
E='5I+E1E<W12=6YN97(N<G5N*'-U:71E*"DI.PH@(" @?0I]"@``
`
end