File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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
Reply locked New topic
Author

Working with Temporary Table

Nazmul Bhuiyan
Greenhorn

Joined: May 23, 2002
Posts: 17
Hi,
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:
stmt.executeQuery(sb1.toString());
stmt.executeQuery(sb2.toString());
stmt.executeQuery(sb3.toString());
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
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

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
Greenhorn

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
Sheriff

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]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Working with Temporary Table
 
Similar Threads
the instance with new apply to String and StringBuffer are different?
StringBuffer Question.
Doubt in StirngBuffer
Working with Temporary Table
equals method and StringBuffer