AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mysql sql statement running in ANT

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Ray in HK
Guest





PostPosted: Mon Jul 04, 2005 11:15 am    Post subject: mysql sql statement running in ANT Reply with quote



I have a script in ANT to load data from a data file and then update a tmp
table.

My problem is that when I run the following sql under mysql client, it works
perfectly. However, when ever I run it in ANT, nothing can be insert into
the temp table.

I have tried to test the result that the data has already been loaded. The
record can be selected from the newly loaded table( DAILY ) but there will
be zero records inserted into the temp table ( the last sql ) . I cannot
figure out the reason for this strange behaviour. Can anyone explain this
to me ?


<target name="loadData" depends="clearData">
<echo message="LOAD DATA USING: ${db.driver} ${db.url}"/>
<sql driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.pw}"
autocommit="true"
onerror="continue"
print="true">
<classpath refid="master-classpath"/>

LOAD DATA LOCAL INFILE '${data.dir}/2.csv'
INTO TABLE DAILY
FIELDS TERMINATED BY ','
LINES TERMINATED BY 'n'
(HSI_D_DATE, D_OPEN, D_HIGH, D_LOW, D_CLOSE, D_VOLUMN);

update DAILY
SET D_SETTLE_DATE=DATE_FORMAT(D_DATE, '%Y-%m-01');

### create temp table ###
DROP TEMPORARY TABLE IF EXISTS tmp_last_month_day;
CREATE TEMPORARY TABLE tmp_last_month_day (
settle_date date
);

### insert last month day into temp table ###
INSERT INTO tmp_last_month_day(
settle_date
)
select max(D_DATE)
from DAILY
GROUP BY D_SETTLE_DATE;


##########################################################


Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.