You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Loughran <st...@apache.org> on 2008/03/14 11:17:20 UTC

Re: ant sql call stored procedure

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@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org