Home > Archive > SQL Server JDBC > October 2005 > Strange error with PreparedStatement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Strange error with PreparedStatement
dwayne@kridan-consulting.com

2005-10-31, 8:23 pm

Hi there,

I have seen one other poster with a similar symptom, but noone was able
to help them. Perhaps this posting will get better results

I have a very simple java method that does the following:
Code:

PreparedStatement pstmt = null;
String sSql = "delete from cmm_installed_object
s where
object_name = ? and object_type = ?";
pstmt = conn. prepareStatement(sSq
l);
pstmt.setString(1, objectName);
pstmt.setString(2, objectType);

pstmt.executeUpdate();
pstmt.close();

For some reason, I am getting the following error at runtime:Code:

com.jnetdirect.jsql.y: Could not find prepared statement with handle 2.

at com.jnetdirect.jsql.y.a(Unknown Source)
at com.jnetdirect.jsql.ay.a(Unknown Source)
at com.jnetdirect.jsql.aj.s(Unknown Source)
at com.jnetdirect.jsql.aj.new(Unknown Source)
at com.jnetdirect.jsql.aj.int(Unknown Source)
at com.jnetdirect.jsql.at. executeUpdate(Unknow
n Source)
at
com.xxx.cpms.jblp.tasks.cmm.dbscriptrunner.ScriptFileSQL. removeFromUninstallL
ist(ScriptFileSQL.java:571)




Now if I change to using a regular Statement and assembling the SQL by
hand, everything works fine.

Can anyone suggest why this may be happening? There are many other
places in our code where we're using PreparedStatements, so I think
there must be some special circumstances I'm not aware of.

Any hints would be appreciated.

Joe Weinstein

2005-10-31, 8:23 pm

Hi Dwayne.
It seems to be a clear egregious bug in the jNetDirect driver
you are using. Have you asked them? I suggest trying MS's latest
2005 driver or the free jTDS driver. If you are in a BEA WebLogic
environment I have other free options for you too.
Joe Weinstein at BEA

dwayne@kridan-consulting.com wrote:

> Hi there,
>
> I have seen one other poster with a similar symptom, but noone was able
> to help them. Perhaps this posting will get better results
>
> I have a very simple java method that does the following:
> Code:
>
> PreparedStatement pstmt = null;
> String sSql = "delete from cmm_installed_object
s where
> object_name = ? and object_type = ?";
> pstmt = conn. prepareStatement(sSq
l);
> pstmt.setString(1, objectName);
> pstmt.setString(2, objectType);
>
> pstmt.executeUpdate();
> pstmt.close();
>
> For some reason, I am getting the following error at runtime:Code:
>
> com.jnetdirect.jsql.y: Could not find prepared statement with handle 2.
>
> at com.jnetdirect.jsql.y.a(Unknown Source)
> at com.jnetdirect.jsql.ay.a(Unknown Source)
> at com.jnetdirect.jsql.aj.s(Unknown Source)
> at com.jnetdirect.jsql.aj.new(Unknown Source)
> at com.jnetdirect.jsql.aj.int(Unknown Source)
> at com.jnetdirect.jsql.at. executeUpdate(Unknow
n Source)
> at
> com.xxx.cpms.jblp.tasks.cmm.dbscriptrunner.ScriptFileSQL. removeFromUninstallL
ist(ScriptFileSQL.java:571)
>
>
>
>
> Now if I change to using a regular Statement and assembling the SQL by
> hand, everything works fine.
>
> Can anyone suggest why this may be happening? There are many other
> places in our code where we're using PreparedStatements, so I think
> there must be some special circumstances I'm not aware of.
>
> Any hints would be appreciated.
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com