• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC Execute Method not working as expected

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem...glad to. The Ranch is the best!!!

Mike
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic