my dog learned polymorphism*
The moose likes JDBC and the fly likes what is a stateful database connection and how to create it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "what is a stateful database connection and how to create it " Watch "what is a stateful database connection and how to create it " New topic
Author

what is a stateful database connection and how to create it

srini carry
Ranch Hand

Joined: Nov 30, 2007
Posts: 83
I want to know what is stateful connection and how can I create it ?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

miro con wrote:I want to know what is stateful connection and how can I create it ?
http://tinyurl.com/mz3x7x


OCUP UML fundamental and ITIL foundation
youtube channel
srini carry
Ranch Hand

Joined: Nov 30, 2007
Posts: 83
Jan Cumps wrote:
miro con wrote:I want to know what is stateful connection and how can I create it ?
http://tinyurl.com/mz3x7x


I first tried that, did not get any help so I am posting in forums ,they say about a stateful connection but donot say what makes a jdbc connection stateful ,we have an very old project and guys there say they create a stateful database connection , when I aksed them what is the diference between stateful and stateless database connection they did not have any answers , and more over they are not good at programming so I cannot expect answers from them and would like to know what they mean , please help me understand if you know the difference ?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

In a stateful connection, you rely on the fact that you will keep on using the same database connection (session) during the run of your application.
Such programs typically use database session variables or temporary tables.
They might set a variable in database action a: (example: user selects country "china", program stores this country in an environment variable).
They can use that variable later on in action b: (example: they have built some views that will restrict data based on that variable, without the need for your program to filter yourself: you can do "select city from world_cities_view" , but the database would only return Chinese cities ).

A stateless connection does not rely on any activity that has occurred in the past. It does not remember anything.
You should treat Connection Pool connections as stateless.

You can use dedicated connections as stateful. The database can remember things for you.


Some info: http://www.dulcian.com/papers/RMOUG/2008_RMOUG_Rosenblum_StateFULL.pdf
 
 
subject: what is a stateful database connection and how to create it