Hi Moran, Thanks for the suggestion. I set autocommit to true and it works fine now.
I had posted another question about sql task but didn't get a response yet. Please can you have a quick look to see if you have any suggestions? I have attached the question below...thanks for all your help. Appreciate it. -Riz. ---------------------------------------------------------------------------- Hi, I am trying to run the sql task on a file using the src attribute of the task (as follows) <target name="cleanDB" depends="init" description="Clears the database "> <sql driver="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://localhost\myinstance:1433;DatabaseName=on_de velop" userid="sa" password="on_develop" src="cleanDB.sql" /> </target> Is there any way I can generalize the above script to delete *ANY* database on the server by sending a parameter to the cleanDB.sql file? So basically, instead of specifying the database name using "DatabaseName=on_develop", I would like to send to my sql script the name of the database to work with. Any ideas? Thanks, -Rizwan. -----Original Message----- From: Moran Ben-David [mailto:[EMAIL PROTECTED] Sent: Thursday, August 25, 2005 12:14 PM To: 'Ant Users List' Subject: RE: sql task sp_dboptions problem Sounds like you're issue is with the SQL Server connection properties. Query Analyzer tends to have different defaults for the connection settings than your Ant initiated connections. Look up the error in a sql site like "www.sqlmag.com", I'm sure there will be an explanation like set AutoCommit on or something like that. moran > -----Original Message----- > From: Rizwan Merchant [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 25, 2005 12:04 PM > To: Ant Users List > Subject: sql task sp_dboptions problem > > Hi, > > I am trying to run an sql task which contains the following command > > > > exec sp_dboption N'on_develop', N'autoclose', N'false' > > > > I can run this command from SQL Query Analyzer without any problems, but > when I try to run this via ant sql task I get the following error: > > > > [sql] Failed to execute: exec sp_dboption N'on_develop', N'autoclose', > N'false' > > > > BUILD FAILED > > C:\workspace\build.xml:409: java.sql.SQLException: [Microsoft][SQLServer > 2000 Dr > > iver for JDBC][SQLServer]ALTER DATABASE statement not allowed within > multi-state > > ment transaction. > > > > > > Has anyone seen this before? Any help would be appreciated. > > > > Thanks, > > -Rizwan. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]