| Author |
creating temporary tables using java code
|
vijay jamadade
Ranch Hand
Joined: May 12, 2008
Posts: 224
|
|
Hi Ranchers,
I want to implement temporary table functionality of oracle in my application. Please tell me how I can create temporary global tables using java code connection object. like as shown below
which if i try to use through connection object gives error
Tell me how to implement these session tables in oracle?
Thanks in advance
|
Regards, Vijay Jamadade.
( Nothing is Impossible.)
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Can you show us your JDBC code?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
vijay jamadade
Ranch Hand
Joined: May 12, 2008
Posts: 224
|
|
Its getting created now but i don't understand how to use it. It is not getting removed after my session expires. Can you tell me how this temporary table functionality works. My requirement is i want to upload some data in this table in one session and if all is good then i want to move this data to the permanent table afterwards. Can you explore little bit more on this scenario.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
With global temporary tables in Oracle only the data is temporary.
|
 |
vijay jamadade
Ranch Hand
Joined: May 12, 2008
Posts: 224
|
|
here in case of temporary table which session is going to consider? And how the session specific data gets deleted because i cleared my session by
java statement in logout but i am still getting the data in the temporary table in java code. How to delete that data.
|
 |
vijay jamadade
Ranch Hand
Joined: May 12, 2008
Posts: 224
|
|
|
I mean how can i end the database session using java. Because when i restart the server then only the table data gets deleted. Can we do it in source after finishing my transaction?
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
vijay jamadade wrote:here in case of temporary table which session is going to consider? And how the session specific data gets deleted because i cleared my session by
java statement in logout but i am still getting the data in the temporary table in java code. How to delete that data.
What session is that? Are you running Java code in the database?
|
 |
vijay jamadade
Ranch Hand
Joined: May 12, 2008
Posts: 224
|
|
Hi Paul,
I have created a struts 2 application through which i am accessing a temporary table that i have created in database. What happens is i insert some data in that and after that i move the data using same application to the permanent table. Now my question is how the data in the temporary table gets deleted using my struts 2.0 application. It gets deleted only when i restart my tomcat server. Do I need to delete the data firing a query through my application itself or is there any functionality provided by temporary tables so that it can delete the data after i move it to the permanent table?
Waiting for your reply. Thanks.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
So the session you are clearing is an HTTPSession? This will do nothing to the data in the temporary table in Oracle. Global temporary tables work that data create in one is deleted when the Oracle session that created it is ended. In a web app. you probably don't have complete control over when this will happen, assuming you are using a connection pool? I'd manually handle it in your application instead.
|
 |
vijay jamadade
Ranch Hand
Joined: May 12, 2008
Posts: 224
|
|
Thank you so much Paul.
Until now i was doing the same. I though there is some way thats why i was discussing regarding that. Fine now.
|
 |
 |
|
|
subject: creating temporary tables using java code
|
|
|