Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / May 2008

Tip: Looking for answers? Try searching our database.

Why exception exporting query result on Derby ?

Thread view: 
MikeRam - 27 Apr 2008 15:30 GMT
q="SELECT * FROM "+dbTable+" WHERE "+FieldName+" BETWEEN ? AND ? ORDER
BY ID";
q="CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY('"+q+"','"+OutFile+"', null, null,
null)";
stm=cn.conn.prepareStatement(q);
stm.setString(1, sd.StringDataOraInizio);
stm.setString(2, sd.StringDataOraFine);
stm.executeUpdate();

I use Apache Derby but,
When i execute the attached code i receive an exception
java.sql.SQLException: No input parameters.

The same query in other point of my program do not produce an exception.
Maybe i can't use system procedure with parameter ?
Thanks
Arne Vajhøj - 27 Apr 2008 16:02 GMT
> q="SELECT * FROM "+dbTable+" WHERE "+FieldName+" BETWEEN ? AND ? ORDER
> BY ID";
[quoted text clipped - 11 lines]
> The same query in other point of my program do not produce an exception.
> Maybe i can't use system procedure with parameter ?

Stored procedures are called via CallableStatement not
PreparedStatement. And with a slightly different syntax.

And I don't think you can use parameters inside '' as you attempt
to do.

Arne
MikeRam - 27 Apr 2008 16:27 GMT
> q="SELECT * FROM "+dbTable+" WHERE "+FieldName+" BETWEEN ? AND ? ORDER
> BY ID";
[quoted text clipped - 12 lines]
> Maybe i can't use system procedure with parameter ?
> Thanks

Even with this syntax i receive the same exception
stm=cn.conn.prepareCall(q);
stm.setString(1, sd.StringDataOraInizio);
stm.setString(2, sd.StringDataOraFine);
stm.execute();

Parametric query are usable in stored procedure
as i see from ref guide:

CallableStatement cs = conn.prepareCall
("CALL SYSCS_UTIL.SYSCS_COMPRESS_TABLE(?, ?, ?)");
cs.setString(1, "US");
cs.setString(2, "CUSTOMER");
cs.setShort(3, (short) 1);
cs.execute();
Arne Vajhøj - 12 May 2008 23:50 GMT
>> q="SELECT * FROM "+dbTable+" WHERE "+FieldName+" BETWEEN ? AND ? ORDER
>> BY ID";
[quoted text clipped - 4 lines]
>> stm.setString(2, sd.StringDataOraFine);
>> stm.executeUpdate();

> Even with this syntax i receive the same exception
> stm=cn.conn.prepareCall(q);
> stm.setString(1, sd.StringDataOraInizio);
> stm.setString(2, sd.StringDataOraFine);
> stm.execute();

You can not use parameters inside a '' argument like that.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.