473,561 Members | 3,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
"<identifie r>".
Expected tokens may include: "NEW". SQLSTATE=42601
C:\eclipse_work space\massSQL>
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_work space\massSQL\c ount.xml
parsing buildfile C:\eclipse_work space\massSQL\c ount.xml with URI =
file:/C:/eclipse_workspa ce/massSQL/count.xml
Project base dir set to: C:\eclipse_work space\massSQL
Build sequence for target(s) `query' is [init, query]
Complete build sequence is [init, query, query3, query2, ]
[antlib:org.apac he.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.
[loadfile] loading C:\eclipse_work space\massSQL\t ransactionCount .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\\plu gins\
\org.apache.ant _1.7.0\\lib\\an t.jar
[echoproperties] ant.file=C\:\\e clipse_workspac e\\massSQL\\cou nt.xml
[echoproperties] ant.file.dailyT ransactions=C\: \\eclipse_works pace\
\massSQL\\count .xml
[echoproperties] ant.home=C\:\\e clipse\\plugins \\org.apache.an t_1.7.0
[echoproperties] ant.java.versio n=1.5
[echoproperties] ant.library.dir =C\:\\eclipse\\ plugins\
\org.apache.ant _1.7.0\\lib
[echoproperties] ant.project.nam e=dailyTransact ions
[echoproperties] ant.version=Apa che Ant version 1.7.0 compiled on
December 13 2006
[echoproperties] awt.toolkit=sun .awt.windows.WT oolkit
[echoproperties] basedir=C\:\\ec lipse_workspace \\massSQL
[echoproperties] database=db0z
[echoproperties] eclipse.pdebuil d.home=/C\:/eclipse/plugins/
org.eclipse.pde .build_3.2.1.r3 21_v20060823/./
[echoproperties] eclipse.pdebuil d.scripts=/C\:/eclipse/plugins/
org.eclipse.pde .build_3.2.1.r3 21_v20060823/scripts/
[echoproperties] eclipse.pdebuil d.templates=/C\:/eclipse/plugins/
org.eclipse.pde .build_3.2.1.r3 21_v20060823/templates/
[echoproperties] errorFile=daily TransactionsErr or.txt
[echoproperties] file.encoding=C p1252
[echoproperties] file.encoding.p kg=sun.io
[echoproperties] file.separator= \\
[echoproperties] java.awt.graphi csenv=sun.awt.W in32GraphicsEnv ironment
[echoproperties] java.awt.printe rjob=sun.awt.wi ndows.WPrinterJ ob
[echoproperties] java.class.path =C\:\\eclipse\\ plugins\
\org.apache.ant _1.7.0\\lib\\an t-antlr.jar;C\:\\ eclipse\\plugin s\
\org.apache.ant _1.7.0\\lib\\an t-apache-bcel.jar;C\:\\e clipse\\plugins \
\org.apache.ant _1.7.0\\lib\\an t-apache-bsf.jar;C\:\\ec lipse\\plugins\
\org.apache.ant _1.7.0\\lib\\an t-apache-log4j.jar;C\:\\ eclipse\\plugin s\
\org.apache.ant _1.7.0\\lib\\an t-apache-oro.jar;C\:\\ec lipse\\plugins\
\org.apache.ant _1.7.0\\lib\\an t-apache-regexp.jar;C\:\ \eclipse\\plugi ns
\\org.apache.an t_1.7.0\\lib\\a nt-apache-resolver.jar;C\ :\\eclipse\
\plugins\\org.a pache.ant_1.7.0 \\lib\\ant-commons-logging.jar;C\: \
\eclipse\\plugi ns\\org.apache. ant_1.7.0\\lib\ \ant-commons-net.jar;C\:\
\eclipse\\plugi ns\\org.apache. ant_1.7.0\\lib\ \ant-jai.jar;C\:\\ec lipse\
\plugins\\org.a pache.ant_1.7.0 \\lib\\ant-javamail.jar;C\ :\\eclipse\
\plugins\\org.a pache.ant_1.7.0 \\lib\\ant-jdepend.jar;C\: \\eclipse\
\plugins\\org.a pache.ant_1.7.0 \\lib\\ant-jmf.jar;C\:\\ec lipse\\plugins\
\org.apache.ant _1.7.0\\lib\\an t-jsch.jar;C\:\\e clipse\\plugins \
\org.apache.ant _1.7.0\\lib\\an t-junit.jar;C\:\\ eclipse\\plugin s\
\org.apache.ant _1.7.0\\lib\\an t-launcher.jar;C\ :\\eclipse\\plu gins\
\org.apache.ant _1.7.0\\lib\\an t-netrexx.jar;C\: \\eclipse\\plug ins\
\org.apache.ant _1.7.0\\lib\\an t-nodeps.jar;C\:\ \eclipse\\plugi ns\
\org.apache.ant _1.7.0\\lib\\an t-starteam.jar;C\ :\\eclipse\\plu gins\
\org.apache.ant _1.7.0\\lib\\an t-stylebook.jar;C \:\\eclipse\\pl ugins\
\org.apache.ant _1.7.0\\lib\\an t-swing.jar;C\:\\ eclipse\\plugin s\
\org.apache.ant _1.7.0\\lib\\an t-testutil.jar;C\ :\\eclipse\\plu gins\
\org.apache.ant _1.7.0\\lib\\an t-trax.jar;C\:\\e clipse\\plugins \
\org.apache.ant _1.7.0\\lib\\an t-weblogic.jar;C\ :\\eclipse\\plu gins\
\org.apache.ant _1.7.0\\lib\\an t.jar;C\:\\ecli pse\\plugins\
\org.apache.ant _1.7.0\\lib\\co mmons-net-1.4.1.jar;C\:\\ eclipse\\plugin s
\\org.apache.an t_1.7.0\\lib\\j akarta-oro-2.0.8.jar;C\:\\ eclipse\
\plugins\\org.a pache.ant_1.7.0 \\lib\\xercesIm pl.jar;C\:\\ecl ipse\
\plugins\\org.a pache.ant_1.7.0 \\lib\\xml-apis.jar;C\:\\e clipse\
\configuration\ \org.eclipse.os gi\\bundles\\10 \\1\\.cp\\lib\
\remoteAnt.jar; C\:\\IBM\\WebSp here\\AppServer \\java\\lib\\to ols.jar;C\:
\\eclipse\\plug ins\\org.eclips e.swt.win32.win 32.x86_3.2.2.v3 235a.jar
[echoproperties] java.class.vers ion=49.0
[echoproperties] java.endorsed.d irs=C\:\\Progra m Files\\Java\
\jre1.5.0_06\\l ib\\endorsed
[echoproperties] java.ext.dirs=C \:\\Program Files\\Java\\jr e1.5.0_06\
[echoproperties] java.home=C\:\\ Program Files\\Java\\jr e1.5.0_06
[echoproperties] java.io.tmpdir= C\:\\DOCUME~1\\ WalkeD\\LOCALS~ 1\\Temp\
[echoproperties] java.library.pa th=C\:\\WINDOWS \\system32;.;C\ :\
\WINDOWS\\syste m32;C\:\\WINDOW S;C\:\\Program Files\\IBM\\Web Sphere MQ\
\Java\\lib;C\:\ \WINDOWS\\syste m32;C\:\\WINDOW S;C\:\\WINDOWS\ \System32\
\Wbem;C\:\\Prog ram Files\\IBM\\IBM CICS Transaction Gateway\\BIN;C\ :\
\apache-ant-1.7.0\\bin;C\:\ \j2sdk1.4.1_01\ \bin;C\:\\Progr am Files\\IBM\
\WebSphere MQ\\bin;C\:\\Pr ogram Files\\IBM\\Web Sphere MQ\\WEMPS\\bin; C
\:\\Program Files\\TextPad 4;C\:\\Program Files\\PuTTY;C\ :\\PROGRA~1\
\IBM\\SQLLIB\\S AMPLES\\REPL;;C \:\\Program Files\\Visual Explain\\lib;C
\:\\Program Files\\CVSNT\\; C\:\\eclipse\\c onfiguration\
\org.eclipse.os gi\\bundles\\71 8\\1\\.cp
[echoproperties] java.runtime.na me=Java(TM) 2 Runtime Environment,
Standard Edition
[echoproperties] java.runtime.ve rsion=1.5.0_06-b05
[echoproperties] java.specificat ion.name=Java Platform API
[echoproperties] java.specificat ion.vendor=Sun Microsystems Inc.
[echoproperties] java.specificat ion.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=mi xed mode
[echoproperties] java.vm.name=Ja va HotSpot(TM) Client VM
[echoproperties] java.vm.specifi cation.name=Jav a Virtual Machine
[echoproperties] java.vm.specifi cation.vendor=S un Microsystems Inc.
[echoproperties] java.vm.specifi cation.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=dail yTransactions.o ut.txt
[echoproperties] path.separator= ;
[echoproperties] schema=isdb1
[echoproperties] sql=connect to db0z user dmfstr1 using dfstr101; SET
SCHEMA isdb1; Select count (*) from isdb1.SUBTRANSA CTION s,
isdb1.subtransa ctiontype st where s.SUBTRANSACTIO NTYPE_SUBTRANSA 12 \=
st.subtransacti ontypeid and s.subtransactio nstatusid \= 2 and
st.SUBTRANSACTI ONMODULEID in (1,2,5,7,8,9) and s.createdon between
'2007-04-09 00\:01\:01.0000 00' and '2007-04-09 23\:59\:01.4240 00';\t
\t \t quit;
[echoproperties] sqlCommands=tra nsactionCount.s ql
[echoproperties] sun.arch.data.m odel=32
[echoproperties] sun.boot.class. path=C\:\\Progr am Files\\Java\
\jre1.5.0_06\\l ib\\rt.jar;C\:\ \Program Files\\Java\\jr e1.5.0_06\\lib\
\i18n.jar;C\:\\ Program Files\\Java\\jr e1.5.0_06\\lib\ \sunrsasign.jar ;C
\:\\Program Files\\Java\\jr e1.5.0_06\\lib\ \jsse.jar;C\:\\ Program Files\
\Java\\jre1.5.0 _06\\lib\\jce.j ar;C\:\\Program Files\\Java\\jr e1.5.0_06\
\lib\\charsets. jar;C\:\\Progra m Files\\Java\\jr e1.5.0_06\\clas ses
[echoproperties] sun.boot.librar y.path=C\:\\Pro gram Files\\Java\
\jre1.5.0_06\\b in
[echoproperties] sun.cpu.endian= little
[echoproperties] sun.cpu.isalist =
[echoproperties] sun.desktop=win dows
[echoproperties] sun.io.unicode. encoding=Unicod eLittle
[echoproperties] sun.jnu.encodin g=Cp1252
[echoproperties] sun.management. compiler=HotSpo t Client Compiler
[echoproperties] sun.os.patch.le vel=Service Pack 2
[echoproperties] today=2007-04-09
[echoproperties] user.country=US
[echoproperties] user.dir=C\:\\e clipse_workspac e\\massSQL
[echoproperties] user.home=C\:\\ Documents and Settings\\Walke D
[echoproperties] user.language=e n
[echoproperties] user.name=walke d2
[echoproperties] user.timezone=
[echoproperties] user.variant=
[echoproperties] userName=****** **
[echoproperties] userPass=****** **
[delete] Could not find file C:\eclipse_work space\massSQL
\dailyTransacti ons.out.txt to delete.
[exec] Current OS is Windows XP
[exec] Error redirected to C:\eclipse_work space\massSQL
\dailyTransacti onsError.txt
[exec] Executing 'cmd.exe' with arguments:
[exec] '/c db2cmd db2 -tx connect to db0z user ******* using
*******; SET SCHEMA isdb1; Select count (*) from isdb1.SUBTRANSA CTION
s, isdb1.subtransa ctiontype st where s.SUBTRANSACTIO NTYPE_SUBTRANSA 12
= st.subtransacti ontypeid and s.subtransactio nstatusid = 2 and
st.SUBTRANSACTI ONMODULEID 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 dailyTransactio ns.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="dailyTran sactions" default="query" basedir=".">

<target name="init" description="pr ep 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="outputFil e" value="dailyTra nsactions.out.t xt" />
<property name="sqlComman ds" value="transact ionCount.sql" />
<property name="errorFile " value="dailyTra nsactionsError. txt" />
<loadfile property="sql" srcFile="transa ctionCount.sql" >
<striplinebreak s/>
<replacestrin g from="THESCHEMA " to="${schema}" />
<replacestrin g from="DATABASE" to="${database} " />
<replacestrin g from="THEUSERNA ME" to="${userName} " />
<replacestrin g from="THEPASSWO RD" to="${userPass} " />
<replacestrin g from="THEDATE" to="${today}" />
<echoproperti es />

<target name="query" depends="init" description="ex ecute sql quarrey
<delete file="${outputF ile}" />
<exec executable="cmd .exe" os="Windows XP" error="${errorF ile}"
resultproperty= "queryResul t" failonerror="fa lse" timeout="180000 ">
<arg value="/c db2cmd db2 -tx ${sql} -z ${outputFile}" />
<sleep seconds="20" />

===transactionc ount.sql===


Select count (*)
from THESCHEMA.SUBTR ANSACTION s, THESCHEMA.subtr ansactiontype st
where s.SUBTRANSACTIO NTYPE_SUBTRANSA 12 = st.subtransacti ontypeid and
s.subtransactio nstatusid = 2 and
st.SUBTRANSACTI ONMODULEID in (1,2,5,7,8,9) and
s.createdon between 'THEDATE 00:01:01.000000 ' and 'THEDATE
23:59:01.424000 ';


Apr 9 '07 #1
0 4005

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> </head> <style type="text/css">
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 password; export to mytable.ixf of ixf messages mytable.msg select * from mytable; connect reset;
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 have done in my test.cmd file
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 check what alias are there? How to change the database password for the id? How to check who all are connected to the database?
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 PowerShell for that scripting, but I can't find a way to run DB2 comands. I've tried db2cmd /w db2cmd /w /i db2cmd /i (this one got me the closest)...
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 . After starting the Bacth file process, the windows application is made to wait using the Thread.sleep() method untill the DB2 commands are executed...
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 ? Thank you very much in advance.
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 and run the sql query. Im using
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.