472,364 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

ant and db2cmd help please

Hi I am having a problem passing some sql to the db2cmd via ant. This
is very confusing as I am doing this exact thing elseware with no
problem (just differant sql, and I have verified the sql is valid) but
in this one I am having problems. Any time I run this I get the
folowing message from the db2 clp window that opens up.

SQL0104N An unexpected token "SET" was found following
Expected tokens may include: "NEW". SQLSTATE=42601
I don't know what is going on here but I am by no means familiar with
db2cmd and all that so any help is apreachated. If I could get this to
work in a batch file or from a command line I am sure I could get the
ant part of it on my own. it is the db2 that is giving me issues.

thanks. Dwayne

this is the console log from ant of what is being passed.
Apache Ant version 1.7.0 compiled on December 13 2006
Buildfile: C:\eclipse_workspace\massSQL\count.xml
parsing buildfile C:\eclipse_workspace\massSQL\count.xml with URI =
Project base dir set to: C:\eclipse_workspace\massSQL
Build sequence for target(s) `query' is [init, query]
Complete build sequence is [init, query, query3, query2, ]
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.
[loadfile] loading C:\eclipse_workspace\massSQL\transactionCount.sql
into property sql
[loadfile] loaded 383 characters
[echoproperties] #Ant properties
[echoproperties] #Mon Apr 09 11:12:51 CDT 2007
[echoproperties] DSTAMP=20070409
[echoproperties] TODAY=April 9 2007
[echoproperties] TSTAMP=1112
[echoproperties] ant.core.lib=C\:\\eclipse\\plugins\
[echoproperties] ant.file=C\:\\eclipse_workspace\\massSQL\\count.xm l
[echoproperties] ant.file.dailyTransactions=C\:\\eclipse_workspace\
[echoproperties] ant.home=C\:\\eclipse\\plugins\\org.apache.ant_1.7 .0
[echoproperties] ant.java.version=1.5
[echoproperties] ant.library.dir=C\:\\eclipse\\plugins\
[echoproperties] ant.project.name=dailyTransactions
[echoproperties] ant.version=Apache Ant version 1.7.0 compiled on
December 13 2006
[echoproperties] awt.toolkit=sun.awt.windows.WToolkit
[echoproperties] basedir=C\:\\eclipse_workspace\\massSQL
[echoproperties] database=db0z
[echoproperties] eclipse.pdebuild.home=/C\:/eclipse/plugins/
[echoproperties] eclipse.pdebuild.scripts=/C\:/eclipse/plugins/
[echoproperties] eclipse.pdebuild.templates=/C\:/eclipse/plugins/
[echoproperties] errorFile=dailyTransactionsError.txt
[echoproperties] file.encoding=Cp1252
[echoproperties] file.encoding.pkg=sun.io
[echoproperties] file.separator=\\
[echoproperties] java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironm ent
[echoproperties] java.awt.printerjob=sun.awt.windows.WPrinterJob
[echoproperties] java.class.path=C\:\\eclipse\\plugins\
\org.apache.ant_1.7.0\\lib\\ant.jar;C\:\\eclipse\\ plugins\
\plugins\\org.apache.ant_1.7.0\\lib\\xercesImpl.ja r;C\:\\eclipse\
\configuration\\org.eclipse.osgi\\bundles\\10\\1\\ .cp\\lib\
\remoteAnt.jar;C\:\\IBM\\WebSphere\\AppServer\\jav a\\lib\\tools.jar;C\:
\\eclipse\\plugins\\org.eclipse.swt.win32.win32.x8 6_3.2.2.v3235a.jar
[echoproperties] java.class.version=49.0
[echoproperties] java.endorsed.dirs=C\:\\Program Files\\Java\
[echoproperties] java.ext.dirs=C\:\\Program Files\\Java\\jre1.5.0_06\
[echoproperties] java.home=C\:\\Program Files\\Java\\jre1.5.0_06
[echoproperties] java.io.tmpdir=C\:\\DOCUME~1\\WalkeD\\LOCALS~1\\Te mp\
[echoproperties] java.library.path=C\:\\WINDOWS\\system32;.;C\:\
\WINDOWS\\system32;C\:\\WINDOWS;C\:\\Program Files\\IBM\\WebSphere MQ\
\Java\\lib;C\:\\WINDOWS\\system32;C\:\\WINDOWS;C\: \\WINDOWS\\System32\
\Wbem;C\:\\Program Files\\IBM\\IBM CICS Transaction Gateway\\BIN;C\:\
\apache-ant-1.7.0\\bin;C\:\\j2sdk1.4.1_01\\bin;C\:\\Program Files\\IBM\
\WebSphere MQ\\bin;C\:\\Program Files\\IBM\\WebSphere MQ\\WEMPS\\bin;C
\:\\Program Files\\TextPad 4;C\:\\Program Files\\PuTTY;C\:\\PROGRA~1\
\IBM\\SQLLIB\\SAMPLES\\REPL;;C\:\\Program Files\\Visual Explain\\lib;C
\:\\Program Files\\CVSNT\\;C\:\\eclipse\\configuration\
[echoproperties] java.runtime.name=Java(TM) 2 Runtime Environment,
Standard Edition
[echoproperties] java.runtime.version=1.5.0_06-b05
[echoproperties] java.specification.name=Java Platform API
[echoproperties] java.specification.vendor=Sun Microsystems Inc.
[echoproperties] java.specification.version=1.5
[echoproperties] java.vendor=Sun Microsystems Inc.
[echoproperties] java.vendor.url=http\://java.sun.com/
[echoproperties] java.vendor.url.bug=http\://java.sun.com/cgi-bin/
[echoproperties] java.version=1.5.0_06
[echoproperties] java.vm.info=mixed mode
[echoproperties] java.vm.name=Java HotSpot(TM) Client VM
[echoproperties] java.vm.specification.name=Java Virtual Machine
[echoproperties] java.vm.specification.vendor=Sun Microsystems Inc.
[echoproperties] java.vm.specification.version=1.0
[echoproperties] java.vm.vendor=Sun Microsystems Inc.
[echoproperties] java.vm.version=1.5.0_06-b05
[echoproperties] line.separator=\r\n
[echoproperties] os.arch=x86
[echoproperties] os.name=Windows XP
[echoproperties] os.version=5.1
[echoproperties] outputFile=dailyTransactions.out.txt
[echoproperties] path.separator=;
[echoproperties] schema=isdb1
[echoproperties] sql=connect to db0z user dmfstr1 using dfstr101; SET
SCHEMA isdb1; Select count (*) from isdb1.SUBTRANSACTION s,
isdb1.subtransactiontype st where s.SUBTRANSACTIONTYPE_SUBTRANSA12 \=
st.subtransactiontypeid and s.subtransactionstatusid \= 2 and
st.SUBTRANSACTIONMODULEID in (1,2,5,7,8,9) and s.createdon between
'2007-04-09 00\:01\:01.000000' and '2007-04-09 23\:59\:01.424000';\t
\t \t quit;
[echoproperties] sqlCommands=transactionCount.sql
[echoproperties] sun.arch.data.model=32
[echoproperties] sun.boot.class.path=C\:\\Program Files\\Java\
\jre1.5.0_06\\lib\\rt.jar;C\:\\Program Files\\Java\\jre1.5.0_06\\lib\
\i18n.jar;C\:\\Program Files\\Java\\jre1.5.0_06\\lib\\sunrsasign.jar;C
\:\\Program Files\\Java\\jre1.5.0_06\\lib\\jsse.jar;C\:\\Progr am Files\
\Java\\jre1.5.0_06\\lib\\jce.jar;C\:\\Program Files\\Java\\jre1.5.0_06\
\lib\\charsets.jar;C\:\\Program Files\\Java\\jre1.5.0_06\\classes
[echoproperties] sun.boot.library.path=C\:\\Program Files\\Java\
[echoproperties] sun.cpu.endian=little
[echoproperties] sun.cpu.isalist=
[echoproperties] sun.desktop=windows
[echoproperties] sun.io.unicode.encoding=UnicodeLittle
[echoproperties] sun.jnu.encoding=Cp1252
[echoproperties] sun.management.compiler=HotSpot Client Compiler
[echoproperties] sun.os.patch.level=Service Pack 2
[echoproperties] today=2007-04-09
[echoproperties] user.country=US
[echoproperties] user.dir=C\:\\eclipse_workspace\\massSQL
[echoproperties] user.home=C\:\\Documents and Settings\\WalkeD
[echoproperties] user.language=en
[echoproperties] user.name=walked2
[echoproperties] user.timezone=
[echoproperties] user.variant=
[echoproperties] userName=********
[echoproperties] userPass=********
[delete] Could not find file C:\eclipse_workspace\massSQL
\dailyTransactions.out.txt to delete.
[exec] Current OS is Windows XP
[exec] Error redirected to C:\eclipse_workspace\massSQL
[exec] Executing 'cmd.exe' with arguments:
[exec] '/c db2cmd db2 -tx connect to db0z user ******* using
*******; SET SCHEMA isdb1; Select count (*) from isdb1.SUBTRANSACTION
s, isdb1.subtransactiontype st where s.SUBTRANSACTIONTYPE_SUBTRANSA12
= st.subtransactiontypeid and s.subtransactionstatusid = 2 and
st.SUBTRANSACTIONMODULEID in (1,2,5,7,8,9) and s.createdon between
'2007-04-09 00:01:01.000000' and '2007-04-09 23:59:01.424000';
quit; -z dailyTransactions.out.txt'
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[sleep] sleeping for 20000 milliseconds
Total time: 20 seconds

the contents of the folowing files are being used.
===count.xml===(pass and username have been blanked for posting)
<project name="dailyTransactions" default="query" basedir=".">

<target name="init" description="prep directories and set times
<format property="today" pattern="yyyy-MM-dd" />
<property name="schema" value="isdb1" />
<property name="database" value="db0z" />
<property name="userName" value="*******" />
<property name="userPass" value="******" />
<property name="outputFile" value="dailyTransactions.out.txt" />
<property name="sqlCommands" value="transactionCount.sql" />
<property name="errorFile" value="dailyTransactionsError.txt" />
<loadfile property="sql" srcFile="transactionCount.sql" >
<replacestring from="THESCHEMA" to="${schema}" />
<replacestring from="DATABASE" to="${database}" />
<replacestring from="THEUSERNAME" to="${userName}" />
<replacestring from="THEPASSWORD" to="${userPass}" />
<replacestring from="THEDATE" to="${today}" />
<echoproperties />

<target name="query" depends="init" description="execute sql quarrey
<delete file="${outputFile}" />
<exec executable="cmd.exe" os="Windows XP" error="${errorFile}"
resultproperty="queryResult" failonerror="false" timeout="180000">
<arg value="/c db2cmd db2 -tx ${sql} -z ${outputFile}" />
<sleep seconds="20" />



Select count (*)
from THESCHEMA.SUBTRANSACTION s, THESCHEMA.subtransactiontype st
where s.SUBTRANSACTIONTYPE_SUBTRANSA12 = st.subtransactiontypeid and
s.subtransactionstatusid = 2 and
st.SUBTRANSACTIONMODULEID in (1,2,5,7,8,9) and
s.createdon between 'THEDATE 00:01:01.000000' and 'THEDATE


Apr 9 '07 #1
0 3903

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
by: Peter Postlbauer | last post by:
hi newsgroup, is there a way to pass a parameter (e.g. password) to a db2script? Example: db2cmd /c db2 -t -fscript.clp script.clp: ---------- connect to mydatabase user myself using...
by: rhjaisingh | last post by:
Folks, I need to create a batch file that will do the following - Establish a DB2 instance Connect to a certain database Get data using an sql and output it to a file So, this is what I...
by: udbadmin | last post by:
Where do you get examples for running db2 udb commands from db2cmd command line editor. Any good sites ...? Need help with db2cmd commands - How to connect to the database using db2cmd? How to...
by: Mesan | last post by:
Does anyone have an idea what it takes to administer DB2 through PowerShell? I want to write some scripts to automate my common DB2 management tasks and I'd really like to be able to use...
by: DeepthiSem | last post by:
Hi Everyone I have an issue in running the DB2 command script using Batch file from Windows application. From my application i am calling the batch file which inturn runs the Db2cmd prompt . ...
by: Azahary | last post by:
Hi, I'm using DB2v8.1.7 on window XP. I got DB2CMD.EXE -> 5 SQL1042C An unexpected system error occurred. when try to execute DB2 command on CLP. Is there any solution for this problem...
by: Cragu | last post by:
Hi Gurus, I'm trying to extract the data from DB2 datas. I used DB2CMD to connect from the CMD prompt from there I'm running a batch file. In that batch file, I will connect to the database...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.