• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating datasource and Closing connection?

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1)When we get a connection using datasource say oracleDatasource .
Lets say during programming, some developer does not close the connection
explicity. Will that connection be returned to connection or will it
be considered as connection leak.

2) As it is said , datasource is created, deployed, and managed separately(by appserver) from the applications that use it. There are two ways in which we can create datasource
A) From appserver admin console. (I understand that datasource can be managed by appserver here)
B) Second way is to create datasource in your pragramme like Datasource ds = new OracleDataSource(); But how will datasource be managed by appserver asi n this case as we are creating it in our programme.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) While the connection will eventually be returned to the pool, it is still a connection leak. It takes time for the connections to be returned and you can run out in the meantime.

2) A datasource created in the code will not be managed by the server. It's useful for testing, but better to define the datasource more globally in real code.
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic