aspose file tools*
The moose likes JDBC and the fly likes problem with temporary table.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem with temporary table.." Watch "problem with temporary table.." New topic

problem with temporary table..

toukhir mujawar
Ranch Hand

Joined: Oct 11, 2006
Posts: 70
i m trying to insert the data into the global temporary table.. and then copying it to the master table.. it is not insertingdata..

the code is

PreparedStatement st =
conn.prepareStatement("insert into tbl_jv01_temp (rec_type,sys_code,bu,pc_mth,pc,zone,circle,div,subdiv,jv_cat,trf_cd,amt_type,amount,acct_type,cc_code,std_mth,pr_mth,bill_dt,due_dt,run_dt,run_time,rtrf,prc_mth,version,tag1) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
// set the parameters
st.setString(1, getRecType());
st.setString(2, getSysCode());
st.setInt(3, getBu());
st.setInt(4, getPcMth());
st.setInt(5, getPc());
st.setInt(6, getZone());
st.setInt(7, getCircle());
st.setInt(8, getDiv());
st.setInt(9, getSubDiv());
st.setInt(10, getJvCat());
st.setInt(11, getTrfCd());
st.setInt(12, getAmtType());
st.setBigDecimal(13, getAmount());
st.setString(14, getAcctType());
st.setInt(15, getCcCode());
st.setInt(16, getStdMth());
st.setInt(17, getPrMth());
st.setInt(18, getBillDt());
st.setInt(19, getDueDt());
st.setInt(20, getRunDt());
st.setString(21, getRunTime());
st.setInt(22, getRtrf());
st.setInt(23, getPrcMth());
st.setInt(24, getVersion());
st.setInt(25, getTag1());
int count = st.executeUpdate();

PreparedStatement st= conn.prepareStatement("insert into tbl_jv01_master select * from tbl_jv01_temp");
int count = st.executeUpdate();

it is not giving any exception... just cant find please help me....
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 29241

Which of the two isn't inserting data? In other words, what is the return value of the first "count"?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Josh Juneau
Ranch Hand

Joined: Jun 16, 2004
Posts: 86
Are you using an IDE? I find that using the debug feature on an IDE can really help in this situation.

For instance, in most IDEs (I use NetBeans) it is helpful to set up a break point at your SQL statement. That way when you debug the application, you can walk through exactly what is happening when it runs. I find it very useful in this type of situation.

My 2 cents...

Database Administrator/Application Developer
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24166

Please don't post the same question to more than one forum. See here for an explanation of why I just deleted several other copies of this thread.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: problem with temporary table..
Similar Threads
one conneciton, multple queries
storing date in mysql
getting NumberFormatException
getting null values, while fetching data
java.sql.SQLException : Missing IN or OUT parameter at index:: 1