Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: ant sql call stored procedure

Steve Loughran

2008-03-14

Replies:

Author LoginPost Reply
Chaohua Wang wrote:
> Hi folks,
>
>
> I am using ant sql to call a stored procedure of Ms Sql server
>
> <sql
>   driver="${jdbcdriver}"
>   url="${dburl}/BillPay"
>   userid="${userid}"
>   password="${password}"
>  src=" uspSelectCount.sql "
>  classpathref="webtest.path.id"
>  </sql>  
>
>
> I can execute stored procedure in Ms Sql server. My stored procedure name is uspSelectCount. But when I am using ant sql to call the file uspSelectCount.sql that is located with the build file.
>
> I always got this exception:
>
> test:
>     [sql] Executing file: C:\workspace\Canoo\billPay\tests\uspSelectCount.sql
>     [sql] Failed to execute:  ?U S E  [ B i l l P a y ] G O / * * * * * *  O b j e c t :   S t o r e d P r o c e d u r e  [ d b o ] . [ u s p S e l e c t C o u n t ]      S c r i p t  D
> a t e :  0 3 / 1 3 / 2 0 0 8  1 5 : 5 1 : 1 3  * * * * * *
>     [sql] java.sql.SQLException: Incorrect syntax near 'E'.
>     [sql] Failed to execute:  S E T  A N S I _ N U L L S  O N G O S E T  Q U O T E D _ I D E N T I F I E R  O N G O - -  = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> = = = = = = = = = = = - -  A u t h o r :         < A u t h o r , , N a m e > - -  C r e a t e  d a t e :  < C r e a t e  D a t e , , > - -  D e s c r i p t i o n :     < D e s c r i p
> t i o n , , > - -  = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = C R E A T E  P R O C E D U R E  [ d b o ] . [ u s p S e l e c t C o u n t ]   A S B
> E G I N - -  S E T  N O C O U N T  O N  a d d e d  t o  p r e v e n t  e x t r a  r e s u l t  s e t s  f r o m - -  i n t e r f e r i n g  w i t h  S E L E C T  s t a t e m e n t s .
>  S E T  N O C O U N T  O N ;   S e l e c t   c o u n t ( * ) f r o m  d b o . P a y m e n t s _ S t a g i n g   E n d
>    [sql] java.sql.SQLException: Incorrect syntax near 'T'.
>
>
> 'E' is the third character of USE. 'T' is the third character of SET. I am not sure the reason why? Please help.

I dont like the look of all the spaces in the message ... it hints that
the SQL task isnt loading in the text in the right encoding, which is
bound to cause trouble. Try playing with the encoding attribute of the
task to get it and the text consistent.


--
Steve Loughran            http://www.1060.org/blogxter/publish/5
Author: Ant in Action       http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.