This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

Working with Temporary Table

 
Nazmul Bhuiyan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm closing this duplicate post as it looks like this conversation is being continued elsewhere...
 
    Bookmark Topic Watch Topic
  • New Topic