This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.