Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

temporary tables

 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • 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 ]
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think JDBC supports creating temporary table but it will be vendor specific.
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
Maydene Fisher
Author
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic