ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moran Ben-David" <mo...@place-base.com>
Subject RE: sql task sp_dboptions problem
Date Thu, 25 Aug 2005 18:42:38 GMT
Sorry Razwan,

I am not familiar with the <sql> task enough to help you on that.  However,
one thing I can suggest is that instead of using the tasks' "src" attribute,
you put the sql from cleanDB.sql in you're ant file as such:


<sql driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:microsoft:sqlserver://localhost\myinstance:1433;DatabaseName=on_de
velop" userid="sa" password="on_develop">

	-- example code from cleanDB.sql
	DROP DATABASE ${the.database.i.wanted.to.pass};

</sql>

Moran

> -----Original Message-----
> From: Rizwan Merchant [mailto:rizwan@alpha-it.com]
> Sent: Thursday, August 25, 2005 1:47 PM
> To: 'Ant Users List'
> Subject: RE: sql task sp_dboptions problem
> 
> 
> 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:moran@place-base.com]
> 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:rizwan@alpha-it.com]
> > 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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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


Mime
View raw message