SQL files execute : Incorrect syntax near 'go'.
Hi ,
Getting below issue when trying to run the ant script.
I am trying to run few sql files from the folder through ant script in which I configured the "jtds-1.2.5.jar".
Unable to run the GO statment in the sql file. But able to execute same file it through sql studio with out any error.
************************************************** **
<target name="runscript">
<sql driver="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://${xxxxx}:${1433}/;"
userid="${aaaaaaaa}" password="${bbbbbb}"
classpathref="jtds-1.2.5.jar">
<path>
<fileset file="${basedir}\source\Mydata.sql"/>
</path>
</sql>
</target>
************************************************** **
ERROR:
************************************************** **
java.sql.SQLException: Incorrect syntax near 'go'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnos tic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(Td sCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(T dsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsStatement.processRes ults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL (JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeImp l(JtdsStatement.java:723)
at net.sourceforge.jtds.jdbc.JtdsStatement.execute(Jt dsStatement.java:1160)
at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLE xec.java:775)
at org.apache.tools.ant.taskdefs.SQLExec.runStatement s(SQLExec.java:751)
at org.apache.tools.ant.taskdefs.SQLExec$Transaction. runTransaction(SQLExec.java:1055)
at org.apache.tools.ant.taskdefs.SQLExec$Transaction. access$000(SQLExec.java:985)
at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLE xec.java:653)
Re: SQL files execute : Incorrect syntax near 'go'.
The file should contain a series of SQL statements, each ending with a semi-colon.
GO is not a SQL statement.
Re: SQL files execute : Incorrect syntax near 'go'.
I used sqlcmd to execute the 'go' statement from ant script.
do JTDS support SQL server 2008 R2 ?
Now i am geting a new issue :
JTDC driver.
SQL server 2008 R2
java.sql.SQLException: Invalid object name 'dbo.xxName'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnos tic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(Td sCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2258)
Re: SQL files execute : Incorrect syntax near 'go'.
What does your script look like?
Because, as I said, 'GO' is not valid SQL syntax.
It's part of T-SQL, which is not going to run through JDBC.
JTDS does support 2008.
That new error is pretty self explanatory.