aspose file tools*
The moose likes JDBC and the fly likes Temporary tables (Oracle) and web based apps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Temporary tables (Oracle) and web based apps" Watch "Temporary tables (Oracle) and web based apps" New topic
Author

Temporary tables (Oracle) and web based apps

Jan Andersson
Greenhorn

Joined: Sep 06, 2007
Posts: 7
Hi,

I have a couple of questions about using Oracle temporary tables with JDBC.
The plan is to aggregate a whole lot of data into a temporary table. Once that table is populated the user will be able to run a few different reports off it.

Now, this will be done as web application running on tomcat and the database is a Oracle 10g.

The problem I'm having is that the data in the table is truncated as soon as the connection is closed. This kind of makes sense since it is available only is a session or a transaction. The only solution i can think of is to try to keep the connection open across requests. But that does not seem like a good idea...?

So does that mean that using temporary tables in a web application is not useful? (Unless you query the table in the same request cycle as you populate it).
Has any one else ran into this problem? is there a solution or a nice workaround?

thanks!

Jan
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Originally posted by Jan Andersson:
The only solution i can think of is to try to keep the connection open across requests. But that does not seem like a good idea...?

You are correct that this is not a good idea. Keeping the connection open places a huge drain on the system. I would look for an alternate approach.

One I can think of:
1) Create a logically "temporary" regular table called userid_temp_table for each user.
2) Populate it and access it the way you did your temp table.
3) Run a job every so often to delete userid_xxx tables that haven't been used in a certain length of time.


[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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Temporary tables (Oracle) and web based apps