How can I kill database connections

I would like to know how can I kill all the database connexion at the end of an application. I'm using acces
thx

use con.close() in a finally statement after your catch blocks that tests whether con equals null. If con != null, then con.close();
example:
finally {
          //close the database connection.
          try {
                  if (con != null) con.close();
          catch (SQLException e) {
}

Similar Messages

  • How can i improve database connectivity with connection pool

    Hi,
    I used to create a connection to DB per session since the application is pretty small. Now i want to improve the db connectrion with connection pool. However, i am still confused since the book i read says that i have to change something in server.xml in the tomcat server while other people in this forum actually implement a connection pool class. Isnt it has been built into the servlet container? if yes, how can i use it? I suppose i only have to open the connection and the connection pool will reclaim the resource when the session is terminated in the same way the gabage collector reclaim resource when no reference is associated to object, am i correct?
    Thai

    the documentation for Tomcat 5 DB pooling can be found at:
    http://jakarta.apache.org/tomcat/tom...les-howto.html
    Here are the Tomcat 4 docs:
    http://jakarta.apache.org/tomcat/tom...les-howto.html
    The administration console can be found at (under default install):
    http:localhost:8080/admin
    But, you have to set up a user and password in your
    <tomcat-install>/conf/tomcat-users.xml file.
    You need to add an "admin" role and a user that will be assigned this
    role like this (obviously you won't be using "tomcat" as your password):
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    <role rolename="admin"/>
    <user username="tomcat" password="tomcat" roles="admin"/>
    </tomcat-users>
    So, I can log in as Tomcat and have admin privs.
    Tomcat 5
    http://jakarta.apache.org/tomcat/tom...ger-howto.html
    Tomcat 4
    http://jakarta.apache.org/tomcat/tom...ion%20A ccess
    i'm sure this helps u

  • How can i include database connection in an EP development

    Does any body knows what are the steps to include database connection in an EP development in NWDS?

    Hi Jose.
    http://help.sap.com/saphelp_nw04/helpdata/en/30/a0f17aacb34b108b39a96acc33da3f/frameset.htm
    or
    http://help.sap.com/saphelp_nw04/helpdata/en/fe/9e362f3d954e8e8555007d8030df63/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
    Regards, Karsten

  • How can i create Database Connection in Swing Applet?

    A DESCRIPTION OF THE PROBLEM :
    I am unable to connect to oracle database using thin driver
    in Swing Applet.
    ENVIRONMENT:
    java version "1.3.1_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
    Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
    FULL OPERATING SYSTEM VERSION : NT 4.0
    Java file:-
    import javax.swing.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.awt.*;
    public class SwingApplet extends JApplet
       public void init(){
       public void start(){
        JTextField txf=new JTextField();
        JButton btn=new JButton("Click Me");
        btn.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ae){
            try{
            DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
            Connection con=DriverManager.getConnection
    ("jdbc:oracle:thin:@orasrv:1521:oracledb","hrisadmin","hrisadmin");
            Statement st=con.createStatement();
            ResultSet rs=st.executeQuery("select * from applicant");
            }catch(Exception e){JOptionPane.showMessageDialog
    (null,e.toString());}
            JOptionPane.showMessageDialog(null,"Hai Swing is cool");
        getContentPane().add(txf,BorderLayout.NORTH);
        getContentPane().add(btn,BorderLayout.CENTER);
       public void stop(){
       public void destroy(){
    html file:-
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
       width="120" height="160" align="middle"
       codebase="http://java.sun.com/products/plugin/1.1.2/
            jinstall-12-win32.cab#Version=1,2,0,0">
       <PARAM NAME="code" VALUE="SwingApplet.class">
       <PARAM NAME="codebase" VALUE=".">
       <PARAM NAME="archive" VALUE="classes111.zip">
    </OBJECT>ERROR MESSAGES/STACK TRACES THAT OCCUR :
    java.security.AccessControlException:access denied(java.net.SocketPermission or
    asrv resolve)

    if the applet runs locally, and you want to connect to your DB locally with the applet, it won't work (except if you adjust the security settings of your browser, maybe). That's because applets don't have access to the computer they're running on (except some information), since that would mean that any applet could just access your computer, so, it's not possible for security purposes.
    On the other hand, they don't have to right to connect to anything, except the server they're downloaded from ( so the webserver's ip).
    But I'm not sure about connecting to a DB through JDBC that way.
    Tom

  • How can i Create Database Link

    Dear Expert,
    I have two servers on that there are two databases then
    how can i create database link.

    CREATE [SHARED][PUBLIC] DATABASE LINK link_name
    [CONNECT TO user IDENTIFIED BY password]
    [AUTHENTICATED BY user IDENTIFIED BY password]
    [USING 'connect_string']

  • How can we handle database exceptions in bpel?

    Hi,
    I'm calling a couple of pl/sql based services in my bpel flow. Given the services are pl/sql based we might hit some databse errors . For example:
    -Existing State of Packages has been discarded
    -Database is down
    -PL/sql procedure itself throws an error etc
    I want to know how can any such database errors be handled gracefully? Can these be handled by a fault handler?If so, how?
    Thanks!

    You can use a catch/catchAll around the scope where these database related activities are happening. Within the Catch/CatchAll block, you can decide and provide the logic for a retrial or termination of the process or any other behaviour that you want.
    HTH
    Rahul

  • I click a link but it doesn't open. Instead I get a popup saying "Open the link in a new window," "Open link in a new tab," etc. How can I kill this popup or whatever it is forever?

    I click a link but it doesn’t open. Instead I get a popup saying “Open the link in a new window,” “Open link in a new tab,” etc. How can I kill this popup or whatever it is forever?

    That happens if the server sends the file as text/plain.
    You can see this if you open "Tools > Page Info > General": Content-Type: text/plain
    Files send this way will always open in a tab.
    *https://developer.mozilla.org/Tools/Web_Console

  • HT1689 How can i fix "cannot connect to iTunes store"?

    How can i fix "cannot connect to iTunes store"?

    Refer to this article:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368

  • How can i kill the Adobe Reader session right away?

    Hello
    I have developed an interactive form, my_form. And we launch / render this my_form in (ERP / SAP) application's portal IE browser, well.
    Say, user opened this form, worked on it, submitted (we have our own submit button) and closed the window by clicking the top right corner's X button, but user is seeing stll the red Reader icon on the bottom bar, even thought the user is closed the window completely
    If user try to close this reader red reader icon explicitly, user is getting the other exception popup as Runtime error as described here http://forums.adobe.com/thread/391738
    Hence, am thinking to KILL the reader session right away the moment user closes the window, pls. let me know,
    1) How can i KILL the reader session via JavaScript, is it possible?
    2) if so, what the JS code i need to put and
    3) in which event pls.?
    Thank you

    In to my original posting, am attaching these pics
    On my desktop it looks like below,
    1) Even though user is closing the window but still the reader icon is lying on the bottom
    2) Once user double cliks the above red icon, user is getting below popup
    Thank you

  • How can i kill a job in BW

    Hi,
    Any budy please help me that how can i kill a background job in BW
    Cheers,
    KGB

    hi u can kill job in SM 37 also.
    also u can cancel in SM50.also use tis link
    How to stop scheduled job in bw.
    Hope it solves your query
    Thanks,
    pathak
    Edited by: npathak on Aug 2, 2010 9:09 PM

  • How can I export database incremental?

    I want export database for backup.
    how can i export database incremental?

    What Oracle version are you using ?
    The following is from 8.1.7 documentation about INCTYPE parameter :
    Incremental, Cumulative, and Complete Exports
    Important: Incremental, cumulative, and complete Exports are obsolete features that will be phased out in a subsequent release. You should begin now to migrate to Oracle's Backup and Recovery Manager for database backups.

  • How can get a database like ****.SQL file for test in sqlplus in oracle8i

    How can get a database like ****.SQL file for test in sqlplus in oracle8i,I am a beginner,thanks

    I'll give it a guess as to what it is you want but I'm afraid you'll have to give some more information to go on. I appreciate it's difficult for people who are beginners or who don't have English as their first language.
    Are you trying to run a SQL file? From SQL*plus you can do either of these:
    SQL> start my_file
    or
    SQL> @my_file
    N.B.: if th efile has a .sql extension you don't need to include it, but you do for any other file extension e.g.
    SQL> @myfile.run
    Here is the page Vijay referred to:
    Re: Physical storage Checks & adding disk on server. I hope you find it useful.
    You will more helpful links (including links to the Oracle on-line manuals at this page:
    Re: How to attach a java bean in forms6i
    good luck, APC

  • I lost my iPhone. how can I kill it?

    I lost my iPhone 4s at airport in oversea.
    Unfortunately, I could not find that.
    When I get back to US, I just bought one and recovered my contact and app etc on my new iPhone.
    But, I don't want somebody use my old iPhone for them.
    How can I kill it? As I heard that IPhone 4s has that kind of function that killed all the pictures & data deleted as first initial time.
    Just let me know. I know my IMEI number and etc.

    It was not activated.

  • I am unintentionally come to delete the bluetooth connection to my heart rate monitor in my iPhone 4s. How can I restore the connection?

    I am unintentionally come to delete the bluetooth connection to my heart rate monitor in my iPhone 4s. How can I restore the connection?

    Thanks, but unfortunately for me the Polar H7 does not have any buttons or anything that can actively affect the pairing, it is manifest just a transmitter. Pairing can apparently only be done by finding the Polar H7 in the unit that you want to pair with (my 4s) and after my delete of the device, my iPhone 4s does not retrieve it as a Bluetooth device.

  • I cannot load my google calendar, how can i decrypt the connection in order to have access?

    The information about this website says that the page has been encrypted because there is no authorized owner. I need access to my google calendar from work.
    How can i decrypt the connection? Is there other way to fix the problem?

    Restart holding down the CMD+R keys, launch Disk Utility and erase the HD, quit DU, and restore the OS. On first boot, use the Setup Assistant to do the migration. Details in Pondini's Setup New Mac guide.

Maybe you are looking for

  • HT4623 Unwanted Alarm/Reminder on iPhone

    My iPhone sets off an alarm/reminder sound when I have it connected to a power source and have the clock application displayed. I cannot find any place I've set it to do this. I can't use it for my alarm clock because this sound comes on randomly--us

  • I am trying to post video to facebook but getting error message

    I cant get my edited video on facebook keeps saying bad imagine? Can anyone give me answers why and help me out please.

  • FBCJ print preview

    Hi All, According to the client requirement for cash Journal print..at FBCJ...we have modified the standard program RFCASH20 and given the program name as ZRFCASH20 and from ..form name F140_CASH_DOC to ZFI40_CASH_DOC...I have assigned the changed fo

  • Importing through scanning - is it possible?

    Up to recently I used Photoshop elements 2 on an old Apple G4 Powerbook to scan photos from an all in one copier, printer and scanner. I used to go to file and imported to scanner. Can this be done on Photoshop Elements 9 which I have downloaded on t

  • Trouble in using  element.tlf_internal::getEventMirror(), examples needed !

    Hi,      I have struck in the using element.tlf_internal::getEventMirror().addEventListener(MouseEvent.CLICK, regionClickHandler)       for a couple of days.      I have Adobe Flash Builder Beta 2, with new version of TextLayout Framework,  but still