• 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

temporary tables

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Does JDBC support
CREATE TABLE #MyNewTemporaryTable ... ?
If JDBC does support local or global temporary tables (indicated by the prefix #, or ## respectively), then I would have a follow-up question:
Can a temporary table, created at run-time thru JDBC, be used by Entity EJBs, provided that they have the matching deployment descriptors? Creating tables is beyond EJB-QL, to my knowledge, but run-time-only tables would be useful for manupulations, especially if they are short-lived and even more-so if they never get written to disk.
(Ram Golam may recognize this tactic from a discussion in another forum)
Thanks in advance!
[ October 07, 2003: Message edited by: john prieur ]
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think JDBC supports creating temporary table but it will be vendor specific.
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java passes the SQL on to the underlying database. If the database supports temporary table creation, then you can execute it through JDBC.
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Java passes the SQL on to the underlying database[/QB]


Thanks. I didn't think
executeUpdate( "CREATE TABLE #Temp ...")
would work, 'cus its DDL. It does and I'm surprised.
Now to find out if EJBs can become associated with Temp....
If this works we might be able to do things like this in EJB-QL...
SELECT f
FROM Things f
where f.id IN (SELECT g.id FROM Temp WHERE ?1)
(assuming that you first create Temp via JDBC and populate it with
the Things of interest, the ids are compatible, and that you want to use a large "collection" of target items to select from f. )
Finally, delete the Temp.
Let us know if you think there is a better way of going about all this.
[ October 07, 2003: Message edited by: john prieur ]
 
Author
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tom Blough:
Java passes the SQL on to the underlying database. If the database supports temporary table creation, then you can execute it through JDBC.


I just want to emphasize the point Tom makes. The JDBC API simply passes your SQL statement to the DBMS. Whether or not the statement works depends on how the DBMS is implemented. If you pass a correct SQL statement for your DBMS, it will work. It's not a function of the JDBC API; its a function of the DBMS and driver.
Cheers,
Maydene
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic