permaculture playing cards*
The moose likes JDBC and the fly likes JDBC Execute Method not working as expected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Execute Method not working as expected" Watch "JDBC Execute Method not working as expected" New topic
Author

JDBC Execute Method not working as expected

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1064
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

Joined: Jul 12, 2002
Posts: 1064
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30377
    
150

Mike,
Thanks for posting the solution so that others who see this thread in the future can benefit.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1064
No problem...glad to. The Ranch is the best!!!

Mike
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC Execute Method not working as expected