Two Laptop Bag
The moose likes JDBC and Relational Databases and the fly likes Working with Temporary Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Reply locked New topic

Working with Temporary Table

Nazmul Bhuiyan

Joined: May 23, 2002
Posts: 17
I created few StringBuffer for my queryString:
StringBuffer sb = new StringBuffer(500);
StringBuffer sb1 = new StringBuffer(500);
StringBuffer sb2 = new StringBuffer(500);
StringBuffer sb3 = new StringBuffer(500);
And then executing these query as follows:
rs = stmt.executeQuery(sb.toString());
I am trying to create a temp table by the sb1 and updating the temp table by sb2 and sb3. Finally I am executing the sb.
I am not sure whether I am able to do this?
Is there any one can help??
Greg Charles

Joined: Oct 01, 2001
Posts: 2968

Creating a table, updating it, and querying it are all SQL operations. Therefore, yes, you can do it with JDBC. The tricky part is putting the right SQL into those StringBuffers.
Nazmul Bhuiyan

Joined: May 23, 2002
Posts: 17
Yes I got the right SQL and is running ok in the database properly.
But when I am running it through JDBC then I am getting null result set.
What I did is:
1. Create the temp table by one sql
2. Insert date by another sql
3. and then update that table couple of times by different SQLs
4. Then select * from that temp table
I executed query 1, 2, 3. When I tried to executeed query 4 and I am getting the resultSet null.
Please help
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
I'm closing this duplicate post as it looks like this conversation is being continued elsewhere...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Working with Temporary Table
It's not a secret anymore!