This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Execute Method not working as expected

 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the (simple) JDBC code below, I can't seem to create temporary table...

String tmpTableCreateSQL = "CREATE TEMPORARY TABLE IF NOT EXISTS tmpTable select * from customer";

boolean success = statement.execute(tmpTableCreateSQL);

>>>> success always returns false. <<<<<

I'd like to be able to get the temp table with something like:

ResultSet temp = statement.getResultSet();

And then manipulate it with UPDATE statements and such.

=====

Why isn't the initial statement returning true? I have lots of customer records and issuing this in an interactive tool works OK.

Thanks in advance.

- Mike
 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured this out. Please disgregard this post.

The reason I didn't get a ResultSet back because I had just done DDL statements. The ResultSet would happen if you then did a SELECT on the table temp table created using the DDL.

Thanks anyway.

- Mike
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
Thanks for posting the solution so that others who see this thread in the future can benefit.
 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem...glad to. The Ranch is the best!!!

Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic