Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #37 > unrolled thread

Why exception exporting q

Started by"MikeRam" <mikeram@THRWHITE.remove-dii-this>
First post2011-04-27 15:21 +0000
Last post2011-04-27 15:21 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.lang.java.databases


Contents

  Why exception exporting q "MikeRam" <mikeram@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
    Re: Why exception exporti "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
    Re: Why exception exporti "MikeRam" <mikeram@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
      Re: Why exception exporti "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000

#37 — Why exception exporting q

From"MikeRam" <mikeram@THRWHITE.remove-dii-this>
Date2011-04-27 15:21 +0000
SubjectWhy exception exporting q
Message-ID<d60Rj.67$VM2.30@nntpserver.swip.net>
  To: comp.lang.java.databases
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

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#39 — Re: Why exception exporti

From"=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this>
Date2011-04-27 15:21 +0000
SubjectRe: Why exception exporti
Message-ID<48149584.5020709@vajhoej.dk>
In reply to#37
  To: MikeRam
MikeRam wrote:
> 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 ?

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

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#40 — Re: Why exception exporti

From"MikeRam" <mikeram@THRWHITE.remove-dii-this>
Date2011-04-27 15:21 +0000
SubjectRe: Why exception exporti
Message-ID<kX0Rj.70$VM2.44@nntpserver.swip.net>
In reply to#37
  To: comp.lang.java.databases
MikeRam wrote:
> 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
> 
> 
> 
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();

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#93 — Re: Why exception exporti

From"=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this>
Date2011-04-27 15:21 +0000
SubjectRe: Why exception exporti
Message-ID<4828c990$0$90269$14726298@news.sunsite.dk>
In reply to#40
  To: comp.lang.java.databases
MikeRam wrote:
> MikeRam wrote:
>> 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();

> 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

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.databases


csiph-web