• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Execute Method not working as expected

 
Mike London
Ranch Hand
Posts: 1290
6
  • 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: 1290
6
  • 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
Sheriff
Posts: 36032
432
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: 1290
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem...glad to. The Ranch is the best!!!

Mike
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!