closing connections in finally block

closing connections in finally block

Hi,

What will happen if I close connection before closing the resultset in the finally clock?

e.g.

finally... { ... conn.close(); rs.Close(); }

If i do as above ... what will happen?

View Answers

February 8, 2011 at 5:04 PM

If your connection management code is using connection pooling, the connection.close would just put the connection back in the pool. Additionally, some database have a cursor resource on the server that will not be freed properly unless it is explicitly closed.









Related Tutorials/Questions & Answers:
closing connections in finally block
closing connections in finally block  Hi, What will happen if I close connection before closing the resultset in the finally clock? e.g. finally... { ... conn.close(); rs.Close(); } If i do as above ... what will happen
finally block
finally block  hii, If I am writing return at the end of the try block and some code in finally block, then the finally block will execute??ADS_TO_REPLACE_1   hello, certainly finally block will execute
Advertisements
try and finally block
try and finally block  hello, If I write System.exit (0); at the end of the try block,ADS_TO_REPLACE_1 will the finally block still execute... where in our java program it will always terminate our program. so finally
When finally block is not executed in Java?
When finally block is not executed in Java?  Hi, I have read that finally block is always executed in Java. But I want to know if there is any conditions when finally is not executed. When finally block is not executed in Java
When finally block is not executed in Java?
When finally block is not executed in Java?  Hi, I have read that finally block is always executed in Java. But I want to know if there is any conditions when finally is not executed. When finally block is not executed in Java
Finally in java
Finally in java In this section we will discuss about finally block in java. Finally block always execute when try block exits. Finally is a block of code that execute after try/catch block. finally will execute whether exception
Example to show Finally exception in java
;     Finally block are the block, that executed when... occured.The Run time always execute the expression in finally block irrespective... the expression in the finally block. Understand with Example.ADS_TO_REPLACE_1
The finally Keyword
; The finally is a Java keyword that is used to define a block.... A finally block typically contains cleanup code that recovers from partial execution of a try block. It is always a good practice to use finally clause after
finally in flex
;Ans: A finally block can appear after the try and catch blocks, and it can... Since no error is thrown, the catch block doesn't run. However, the finally block does run. Similarly, the finally block will run even when an error
Finally() in Java
Finally() in Java  After an exception i excute some statement in Finally block.After Fianally block we can execute statements??? if possible... exception1; } Catch(exception1 e) { .... } Finally { try{ }catch(Exeception e
Interact with connection pools to obtain and release connections
. Closing connection handles for shareable connections... a close() in a finally block, to guarantee that it is called. ADS... of a finally block that contains the close(). Because the close
Does finally always execute in Java?
Does finally always execute in Java?  Hi, I am learning exception handling in Java. I want to know if finally{} block is always executed or not in Java? Does finally always execute in Java? Thanks
Does finally always execute in Java?
Does finally always execute in Java?  Hi, I am learning exception handling in Java. I want to know if finally{} block is always executed or not in Java? Does finally always execute in Java? Thanks
Does finally always execute in Java?
Does finally always execute in Java?  Hi, I am learning exception handling in Java. I want to know if finally{} block is always executed or not in Java? Does finally always execute in Java? Thanks
Java finally
a good practice to use finally clause after the try and catch block to handle... the finally block always executes when the try block exits and it is also useful to write the cleanup code within the finally block because it will be executed surely
ModuleNotFoundError: No module named 'connections'
ModuleNotFoundError: No module named 'connections'  Hi, My Python... 'connections' How to remove the ModuleNotFoundError: No module named 'connections' error? Thanks   Hi, In your python environment
Statement block
Statement block  What is the purpose of a statement block
httpd.conf max connections
connections? Thanks   Hi, You can add following configuration in httpd.conf file to increase the number of connections to be handled by apache server
DOubt in Mysql connections
DOubt in Mysql connections  i have some problem regarding data base connections, i have created a hostname, username and password in filezilla server but after i give those names also it is showing error like this: mysql
Closing the browser window
Closing the browser window  <BODY> <form> <input type=button value="Close Window" onClick="javascript:window.close();"> </form> <center> <font face="arial, helvetica" size="-2">Free
Java try, catch, and finally
, catch and finally block is given below: ADS_TO_REPLACE_1 try... Java try, catch, and finally         The try, catch, and finally keywords are Java keywords
Connections with MicroSoft SQL - JDBC
Connections with MicroSoft SQL  How to Connect Java and MS SQL?? Actually i used below code i got SQLException and class not found... import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet
ModuleNotFoundError: No module named 'mypy-boto3-codestar-connections'
ModuleNotFoundError: No module named 'mypy-boto3-codestar-connections' ...: ModuleNotFoundError: No module named 'mypy-boto3-codestar-connections' How to remove the ModuleNotFoundError: No module named 'mypy-boto3-codestar-connections' error
ModuleNotFoundError: No module named 'django-connections'
ModuleNotFoundError: No module named 'django-connections'  Hi, My... named 'django-connections' How to remove the ModuleNotFoundError: No module named 'django-connections' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'nw-connections'
ModuleNotFoundError: No module named 'nw-connections'  Hi, My... named 'nw-connections' How to remove the ModuleNotFoundError: No module named 'nw-connections' error? Thanks   Hi, In your python
How to make a closing eyes, make a closing eyes, closing eyes
How to make a closing eyes       This is a funny example, It is great effort to make still eye to closing eye. You will learn here how is it made possible
Java Function for block inside a block
Java Function for block inside a block  Write a function in Java that attempts to place a set of squares of varying widths into another, larger square. If there is no possible layout, return undefined. Otherwise, return
Java Function for block inside a block
Java Function for block inside a block  Write a function in Java that attempts to place a set of squares of varying widths into another, larger square. If there is no possible layout, return undefined. Otherwise, return
java: try finally blocks execution
java: try finally blocks execution  java: try finally blocks execution
Does finally always execute in Java?
Does finally always execute in Java?  Does finally always execute in Java
How sql Queries possible in DAO without creating Database connections - Java Beginners
How sql Queries possible in DAO without creating Database connections  In DAO we are writting sql queries , how it is possible without creating and closing database connections
ModuleNotFoundError: No module named 'django-user-connections'
ModuleNotFoundError: No module named 'django-user-connections'  Hi...: No module named 'django-user-connections' How to remove the ModuleNotFoundError: No module named 'django-user-connections' error? Thanks   
ModuleNotFoundError: No module named 'django-user-connections'
ModuleNotFoundError: No module named 'django-user-connections'  Hi...: No module named 'django-user-connections' How to remove the ModuleNotFoundError: No module named 'django-user-connections' error? Thanks   
ModuleNotFoundError: No module named 'block'
ModuleNotFoundError: No module named 'block'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'block' How to remove the ModuleNotFoundError: No module named 'block'
ModuleNotFoundError: No module named 'multi-thread-closing'
ModuleNotFoundError: No module named 'multi-thread-closing'  Hi...: No module named 'multi-thread-closing' How to remove the ModuleNotFoundError: No module named 'multi-thread-closing' error? Thanks   Hi
ModuleNotFoundError: No module named 'multi-thread-closing'
ModuleNotFoundError: No module named 'multi-thread-closing'  Hi...: No module named 'multi-thread-closing' How to remove the ModuleNotFoundError: No module named 'multi-thread-closing' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo10-addon-project-closing'
ModuleNotFoundError: No module named 'odoo10-addon-project-closing'  ...: No module named 'odoo10-addon-project-closing' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-project-closing' error
ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo10-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo11-addon-project-closing'
ModuleNotFoundError: No module named 'odoo11-addon-project-closing'  ...: No module named 'odoo11-addon-project-closing' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-project-closing' error
ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo11-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo12-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo8-addon-l10n-es-fiscal-year-closing'
ModuleNotFoundError: No module named 'odoo8-addon-l10n-es-fiscal-year-closing...: ModuleNotFoundError: No module named 'odoo8-addon-l10n-es-fiscal-year-closing' How...-year-closing' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo8-addon-l10n-es-fiscal-year-closing'
ModuleNotFoundError: No module named 'odoo8-addon-l10n-es-fiscal-year-closing...: ModuleNotFoundError: No module named 'odoo8-addon-l10n-es-fiscal-year-closing' How...-year-closing' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo8-addon-project-closing'
ModuleNotFoundError: No module named 'odoo8-addon-project-closing'  ...: No module named 'odoo8-addon-project-closing' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-project-closing' error? Thanks
ModuleNotFoundError: No module named 'odoo8-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo8-addons-oca-account-closing' ...: ModuleNotFoundError: No module named 'odoo8-addons-oca-account-closing' How to remove the ModuleNotFoundError: No module named 'odoo8-addons-oca-account-closing'
ModuleNotFoundError: No module named 'odoo9-addon-project-closing'
ModuleNotFoundError: No module named 'odoo9-addon-project-closing'  ...: No module named 'odoo9-addon-project-closing' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-project-closing' error? Thanks

Ads