« Return to Thread: issues with SQL task and the PRINT statement in external .sql files

Re: issues with SQL task and the PRINT statement in external .sql files

by Steve Loughran :: Rate this Message:

Reply to Author | View in Thread

Nathan Hattala wrote:

> Hello,
>
>   So I have been banging my head against a wall it seems because I have
> been trying to automate the database build and deployment process for
> our software.  The goal I have is using ANT and the sql task, to execute
> an existing .sql file that was developed and placed in SVN.  I am having
> an issue that when I execute the scripts using the ant SQL task, it does
> not give me the results for the sql statement PRINT.  It just seems to
> ignore it and not give me the message in the output.  All I get is "0
> rows affected".  This is frustrating because I can't seem to get ANT to
> give me the message.  The print statements contain information that is
> good for logging what the results of the script.  
>
>  
>
> The manual process has been to just run the scripts using enterprise
> manager and copy the results into a file and just save the file.  If I
> didn't need this to run on a unix machine and connecting to MS-SQL
> databases I would be using something like sqlplus or the sqlcmd tool on
> windows.  But I would like to use ANT to do all the execution of the
> scripts.  Any suggestions?  Is there a better solution out there?
>

>  
>
> Here is an example of a simple script that will illustrate what I am
> trying to do....
>
>  
>
> PRINT 'This is a message to signify that a select statement is going to
> be run:'
>
> SELECT * FROM SomeTable
>

1. what happens in -verbose mode? in -debug?
2. is PRINT something that the JDBC driver itself handles?

I dont think ant deliberatly drops the print statements, I just suspect
it doesnt display any output because either it gets filtered out, or it
doesn't get the output. If you can find out what is happening, we can
see how to improve the task

...

looking at some code of my own that is derived from it, I call
ResultSet.getWarnings() to get the warnings from a result set, and print
these. but I dont think print statements are in warnings. How do you get
them from a ResultSet?

-steve

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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

 « Return to Thread: issues with SQL task and the PRINT statement in external .sql files