How to test if db connection is available

I have got the following code to conenct to database.
package com.db;
import java.util.*;
import java.io.*;
import java.sql.*;
import javax.servlet.http.*;
public class ConnectionManager implements HttpSessionBindingListener
  private Connection connection;
  private Statement statement;
  private String driver = "";
  private String dbURL = "";
  private String login = "";
  private String password = "";
static public void main(String[] args)
      ConnectionManager cm = new ConnectionManager();
  } // main
public ConnectionManager()
       Properties Prop = new Properties();
       try {
          InputStream configStream = getClass().getResourceAsStream("/config/database.properties");
               Prop.load(configStream);
          configStream.close();
           } catch(IOException e) {
                  System.out.println("Error: Cannot laod configuration file ");
       driver =Prop.getProperty("driver");
       dbURL = Prop.getProperty("dbURL");
        login = Prop.getProperty("login");
        password = Prop.getProperty("password");
public void setDriver (String sDriver)
   if (sDriver != null)
       driver = sDriver;
public String getDriver ()
   return driver;
public void setDbURL (String sDbURL)
    if (sDbURL != null)
     dbURL = sDbURL;
public String getDbURL()
   return dbURL;
public void setLogin (String sLogin)
   if (sLogin != null)
      login = sLogin;
public String getLogin()
   return login;
public void setPassword (String sPassword)
   if (sPassword != null)
      password = sPassword;
private String getPassword()
   return password;
private void getConn ()
   try
      Class.forName(driver);
      connection = DriverManager.getConnection(dbURL,login,password);
      statement=connection.createStatement();
   catch (ClassNotFoundException e)
      System.out.println("ConnectionManager: driver unavailable");
      connection = null;
   catch (SQLException e)
      System.out.println("ConnectionManager: driver not loaded");
      connection = null;
public Connection getConnection()
   if (connection == null)
      getConn();
   return connection;
public void commit() throws SQLException
    connection.commit();
public void rollback() throws SQLException
    connection.rollback();
public void setAutoCommit(boolean autoCommit)
    throws SQLException
    connection.setAutoCommit(autoCommit );
public ResultSet executeQuery(String sql) throws SQLException
    if (connection == null || connection.isClosed())
        getConn();
    return statement.executeQuery(sql);
public int executeUpdate(String sql) throws SQLException
    if (connection == null || connection.isClosed())
        getConn();
    return statement.executeUpdate(sql);
public void valueBound(HttpSessionBindingEvent event)
    System.err.println("ConnectionBean: in the valueBound method");
    try
      if (connection == null || connection.isClosed())
        connection = DriverManager.getConnection(dbURL,login,password);
        statement = connection.createStatement();
    catch (SQLException e)
      e.printStackTrace();
      connection = null;
public void valueUnbound(HttpSessionBindingEvent event)
    close();
public void close()
   try
       if ( connection != null
            || !connection.isClosed())
        connection.close();
   catch (SQLException e)
      e.printStackTrace();
My aim is to find out if a connection is available. so that when multiple user hit the first page, it will serve the user only when a connection is available and will display an error message if there is non.
I have tried the following with database shutdown. This still return a string regardless if any connection is available.
<%
com.db.ConnectionManager CM = new com.db.ConnectionManager();
out.println(CM);
%>Please could you suggest a way I could know if a conenction is availble.
Thank you.

I would propose you create a Stack of Connections POP out the Connection whenever a user requests and Push a Connection back when the User is through and releases the connection this way if you try to POP a connection which is not present you can notify the user that the Connection is not available .
Ideally the Architecture of the class should be like this :-
A Class SQLProvider
some methods within it like
getConnection [Should be a Static Method ]
return Connection
destroy etc etc
The Instance will be a Vector which will be used as a stack You can Use a Stack either . and the Connection will be a part of the Vector / Stack .
The getConnection will Pop out elements and if not present should return a Message / Exception this is to your requirements .
A Static Code snippet which will populate the Stack once with the connection etc .
Does that Gives you Idea how to write the code ?
S

Similar Messages

  • HOw to test the jms connection?

    HI all,
    how to test the jms connection in xi?
    regards
    kish

    HI,
    We can see the JMS sender or reciver side .. in RWB .. see  communicaiton channel mononitoring,., also..
    We can access it through browser.. it depends upon the proocol type .. like sonic or webspeare MQ..or ...
    see below links
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/886a3c3a860657e10000000a114084/frameset.htm
    /people/alessandro.guarneri/blog/2006/01/04/jms-sender-adapter-handling-too-short-lines
    /people/william.li/blog/2006/11/13/how-to-use-saps-webas-j2ees-jms-queue-in-exchange-infrastructure
    content conversion https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f02d12a7-0201-0010-5780-8bfc7d12f891
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/97171dd3-0401-0010-5195-b43f556e6ce9
    Chilla

  • How can I get whether connection's available??

    hello, everyone...
    sorry but My English skill is not good.. ( I'm Korean ^^ )
    I wanna get available of connecion ..
    like a [PING] command...Oracle Server is alive or not
    I don't know that the OCCI function supporting function like a PING exists....
    Please Help...

    I think you are going to have to try connecting and catch the exception to see if it is alive.

  • How to test XI- Reciever connection from RWB. (RFC-XI-WebService)

    Hi Experts
    I have built the RFC to XI to Web Services scenario. My RFC destination is yet to be created. But I wanted to test "XI to Web Services" part in the Run time Work Bench.
    As per my scenario design I have to send 1. First Name and 2. Last Name as pay load and the webservice will accept the two parameters, concatenate the two strings and send "Full Name" to XI.
    Kindly provide me the steps to test the Webservice part in my scenario from RWB.
    Regards
    Ram

    Hi,
    1. With the below provided steps you can monitor up to IE
    Open Message/ Interface Mapping > Enter the details (First, Last Name)> Change the view to get the source code...just click SRC button--> Copy the entire payload --> RWB: Component Monitoring --> Integration Engine > Test Message> Enter Details --> Send.
    2. If you want to see target then ask your web service team to provide target web service URL and details
    Rgds,
    MFH

  • How to test multiple Resource connection in sun Idm

    Hi,
    I am configuring 1000+ servers by importing one resource.xml file in IDM. The resources are added in the resource list in IDM.
    But i want to check the connectivity of each resource. Is there any procedure to check the connectivity of all resources at a time.
    please help
    Thank you

    Hi,
    I am configuring 1000+ servers by importing one resource.xml file in IDM. The resources are added in the resource list in IDM.
    But i want to check the connectivity of each resource. Is there any procedure to check the connectivity of all resources at a time.
    please help
    Thank you

  • How to create a new connection from SAPGUI to Test drive?

    Hi,
    I have installed Sap Netweaver Test drive on a linux virtual machine (windows host). The installation was successful and I was able to start the instance (application server and the database), yet I don't know how to create a new connection from my SAPGUI client (7.20) to this server. The static IP address of the server is 192.168.1.160.
    I entered the following values for my new connection entry
    Description: SAP Netweaver
    Application server: 192.168.1.160
    Instance number: 01
    System ID: DB2
    SAProuter: /H/192.168.1.160/S/3201/H/
    But it does not work. Any idea about the values needed  for creating a new entry?
    Thanks in advance,
    Dariyoosh

    >
    Dibya R Das wrote:
    > Why are you entering a router string? Can't you reach a box directly from your machine?
    >
    > Doesn't a ping to that host & a "telnet <host/ip address> 3201" work from your machine to the SAP System.
    >
    > Remove the router string you wont need if the above works.
    >
    > - Regards, Dibya
    Hello there,
    Thank you very much for your answer which solved my problem. In fact there was no need of providing router string.
    Kind Regards,
    Dariyoosh

  • How can i test my vpn connection?

    so recently i decided to test if ver 1.3.0.3 of the quickvpn client would work better with the 1.3.0.5 rvs4000 firmware. i loaded quickvpn to an xp pro computer (freshly built, i might add) and got to work. in order to test the connection, i attempted to piggy back off an unsecured wireless network. this network is on the same ISP network as i am.
    i use dynamic DNS, and the unsecured wireless network could resolve my IP correctly, but for some reason i couldnt connect to my home network from the unsecured network. my router is set to respond to lan requests, but i couldnt ping it. my router passes HTTP traffic to a computer in my network, but i couldnt bring up the webpage. finally, my router responds with the router config page over port 443, and i couldnt bring that up.
    so i used my ISP's dialup service to test. initially, as always, i had a million problems with the vpn client. systematically, i tried to resolve the issues. i installed the patch in the readme for quickvpn. i checked log files to see where stuff was failing. eventually, i could connect to the VPN, but would get that "remote gateway is not responding" crap. i know of a (poor) workaround for this which allows you to "finalize" the connection, but that workaround doesnt allow you to ping around in your network. sometime later, after randomly messing with settings, the tunnel would connect without the workaround. i have no idea what "fixed" this.
    despite all this, my 28.8Kbps connection wouldnt allow me to do anything meaningful on my network. i couldnt connect to the router or to a server of mine (http or fileshare). the only thing i could do was ping internal devices. other requests seemed to "hang" rather than timeout or do anything more concrete. basically, i gave up on testing using dialup, even though my router and the client software confirm a good connection. but i still wasnt convinced.
    next, i figured i could create some type of "DMZ" on my network by placing a switch between my ISP's modem and my router. im not a cisco network professional by any means, but im pretty familiar with networking on a above-average level. that said, despite my best, i couldnt get my quickvpn computer to see my router from the "DMZ".
    finally, i figured i could just test the tunnel while directly connected to my network's lan. bad idea. everything seems to go okay until it locks up on "activating policy". rebooting or otherwise ending the negotiation ends in the computer being unable to do anything anymore. when i try to ping anything, i get "negotiating ip security" ad infinitum. the only way i could fix this was by doing a system restore.
    so here's the question: how can i test my quickvpn connection?why can't i just tunnel through my network? and before you scream that you can't, thegreenbow vpn client has NO PROBLEM connecting to my rvs4000 while connected to my own network.

    Hi Aaron,
    I am going exactly the same thing as you however, I had my cousin buy and install a RVS4000 at his house in Australia.
    I access it from the USA so that I can help manage his Local Area Network, he is just not technical..
    I setup a DDNS client on his RVS4000 so that I can always get to his Router via a domain name rather than a IP address.
    I noticed that you didn't mention anything regarding importing client certificate into the directory of the VPN client on your PC.
    I also noticed I disabled IPSec passthrough on the router in Australia, see the pictures below, not sure why, but the VPN client is working.
    I also did not setup any gateway to gateway VPN tunnels, Only added a client , exported certificate as per the manual, See the last screen capture below.
    You will also note if you view the screen captures that my cousins RVS4000 has not been upgraded to the new code.Is there a reason for that...not really...he's just a user, not really technical.  Also note I have not added any VPN tunnels on my RVS4000.
    I have a reasonably reliable connection between the USA and Australia. I didn;t have to play with any other options, just add users to the VPN client database.
    Your description of the working environment of your PC is missing details on the version of XP, so i will mention the following taken from the software release notes of the RVS4000 ;
    There is a known issue with Windows XP SP2 Firewall.
    ICMP packets are always dropped by the firewall when the firewall is enabled.
    This issue causes the QuickVPN client to be unable to establish a tunnel with the remote QuickVPN server successfully.
    Microsoft has released a patch to fix this issue, which you can get from:
    http://support.microsoft.com/kb/889527/en-us
    After you install the patch, the issue should be resolved. You can also fix this issue by upgrading Windows XP to SP3.
    You cannot plug a PC on the same network as the router for testing, they must be on dissimilar WAN  networks for testing purposes.
    Your remote  PC VPN client will not be allocated a IP address in the RVS4000's network, hosts behind the RVS4000 will still respond to pings, as they direct the responses to their default gateway, the RVS4000.
    The thegreenbow VPN client is a distracter at this point costing 50 something EURO  for a license, lets try to get the quickVPN client working !
    So, if you still wish try the following, firstly make sure your XP has been upgraded to  SP3;
    1.  If you upgraded your router to the new version of code, then reset your router to factory defaults to re-initialize your router, yes start again.
    2.  Export the VPN client certificate to the directory that contains the VPN client.  In my case it is;
               "C:\Program Files\Cisco Small Business\QuickVPN Client"
    3.  add a VPN client account to the router
    4.  Use port 60443 from the quickVPN client. and try  VPNing to the router.
    5  hmmm, if the client still fails try disabling IPSec Passthrough on the router for grins and giggles.
    If this fails, call the SBSC at the following location for resolution;
    http://www.cisco.com/en/US/support/tsd_cisco_small_business_support_center_contacts.html
    good luck ...regards Dave

  • How to test the connection between DSD backend and DSD connector

    Dear all,
    I am configuring the MDSD scenario .. and i want to insure that my customization is correct
    How to test the connection between DSD Backend and DSD connector ??

    Hi Viren,
    The problem is:
    We have a new BW system. The basis people asked me to check the connection between this BW system and the R/3. There is only one client for now(100). I have logged into 100 and tried executing RSA1 to check the connection, but it gave a message box saying "You can only work in Client 000". Then I have treid logging into 000(just to make sure) and tried executing RSA1. Even here I got a message saying "The SAP BW system must not be operated in client 000". Now, I am not sure of what is wrong in clien 100. I am not sure if I have to do some settings before I access RSA1 or any other BW transaction. Could you please help me in this.
    Also, I just checked the RFC destinations in BW. There is a destination created for our R/3 and I have noticed that they have given a remote UserID and password for remote login. I tried to check the Remote UserID in SU01 but there is no userID with that name. Could this be a problem?
    Thanks,
    RPK.

  • How to test the OID IT Resource connection

    Hi,
    I am trying to test the connectivity of the OID IT Resource in OIM. Could somebody help me in knowing how to test the connectivity of the resource.
    Regards,
    Nitin

    Hi Suren,
    I am not using any Ldap browser. I am using Oracle Directory Manager.
    I tried giving the following value in my searchfilter (objectclass=top)(cn=HPOONIA).
    But I am getting the following errors :
    Parameter Variables passed into com.thortech.xl.integration.OID.util.tcUtilLDAPOperations:tcUtilLDAPOperations(): Login Variables are:: are sServerName = 129.146.14.92, sPortNo = 389, sPrincipalDN = cn=orcladmin,cn=Users,dc=csc,dc=com, sProviderURL = ldap://129.146.14.92:389,
    INFO,09 Apr 2010 04:40:09,317,[XL_INTG.OID], Parameter Variables passed into com.thortech.xl.integration.OID.util.tcUtilLDAPOperations:tcUtilLDAPOperations(): Login Variables are:: are sServerName = 129.146.14.92, sPortNo = 389, sPrincipalDN = cn=orcladmin,cn=Users,dc=csc,dc=com, sProviderURL = ldap://129.146.14.92:389,
    DEBUG,09 Apr 2010 04:40:09,318,[XL_INTG.OID], Parameter Variables passed into com.thortech.xl.integration.OID.util.tcUtilLDAPOperations:tcUtilLDAPOperations(): Login Variables are:: for isSSLEnabled = false
    DEBUG,09 Apr 2010 04:40:09,318,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : tcUtilLDAPOperations():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,322,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : processChange():: STARTED
    DEBUG,09 Apr 2010 04:40:09,322,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : checkEmpty():: STARTED
    DEBUG,09 Apr 2010 04:40:09,322,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : checkEmpty():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,322,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : checkEmpty():: STARTED
    DEBUG,09 Apr 2010 04:40:09,322,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : checkEmpty():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,322,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : getSearchAttributes():: STARTED
    DEBUG,09 Apr 2010 04:40:09,323,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : getFieldMappings():: STARTED
    DEBUG,09 Apr 2010 04:40:09,323,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : getSearchAttributes():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,323,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : connectToAvailableOID():: STARTED
    DEBUG,09 Apr 2010 04:40:09,323,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : hashTableEnv():: STARTED
    DEBUG,09 Apr 2010 04:40:09,335,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : hashTableEnv():: FINISHED
    INFO,09 Apr 2010 04:40:09,335,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : connectToAvailableOID() : SSL option is not selected in ITResource
    DEBUG,09 Apr 2010 04:40:09,348,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : connectToAvailableOID():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,348,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : doReconSearch():: STARTED
    DEBUG,09 Apr 2010 04:40:09,349,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : isPagingSupport():: STARTED
    DEBUG,09 Apr 2010 04:40:09,353,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : isPagingSupport():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,353,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch():: STARTED
    DEBUG,09 Apr 2010 04:40:09,354,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : Parameter Variables passed are: pSearchBase = [cn=Users,dc=csc,dc=com], pFilterExpression = [(&(objectclass=top)(cn=HPOONIA)(modifyTimestamp>=19000101010001Z))], pIsRelative = [true], pAttrNames = [[Ljava.lang.String;@3250b1]
    INFO,09 Apr 2010 04:40:09,354,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : Parameter Variables passed are: pSearchBase = [cn=Users,dc=csc,dc=com], pFilterExpression = [(&(objectclass=top)(cn=HPOONIA)(modifyTimestamp>=19000101010001Z))], pIsRelative = [true], pAttrNames = [[Ljava.lang.String;@3250b1]
    DEBUG,09 Apr 2010 04:40:09,354,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : javax.naming.directory.SearchControls@14fa707search controls**********************
    DEBUG,09 Apr 2010 04:40:09,354,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : count limit**********************
    DEBUG,09 Apr 2010 04:40:09,354,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : subtree scope**********************
    DEBUG,09 Apr 2010 04:40:09,354,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : setting returning attributes if NOT NULL**********************
    DEBUG,09 Apr 2010 04:40:09,370,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : DID NOT FIND ANY RECORDS after Modified Time Stamp
    DEBUG,09 Apr 2010 04:40:09,370,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : parseControls():: STARTED
    DEBUG,09 Apr 2010 04:40:09,370,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : getControlInstance():: STARTED
    DEBUG,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : getControlInstance():: FINISHED
    INFO,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : parseControls() : >>Next Page
    DEBUG,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : parseControls():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : cookie: [B@5eef81
    DEBUG,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : cookie length : 0
    DEBUG,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch() : Total No Of Records are reconciled are = 0
    DEBUG,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : disconnectFromLDAP():: STARTED
    DEBUG,09 Apr 2010 04:40:09,376,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : disconnectFromLDAP() : Closing initial directory context
    DEBUG,09 Apr 2010 04:40:09,380,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : disconnectFromLDAP():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,381,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : pagingReconSearch():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,381,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : doReconSearch():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,381,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : disconnectFromLDAP():: STARTED
    DEBUG,09 Apr 2010 04:40:09,381,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : disconnectFromLDAP() : Closing initial directory context
    DEBUG,09 Apr 2010 04:40:09,381,[XL_INTG.OID],com.thortech.xl.integration.OID.util.tcUtilLDAPOperations : disconnectFromLDAP():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,381,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : processChange():: FINISHED
    DEBUG,09 Apr 2010 04:40:09,381,[XL_INTG.OID],com.thortech.xl.integration.OID.schedule.tasks.tcTskOIDUserReconciliation : execute():: FINISHED
    Please help.
    Regards,
    Nitin

  • How to test if connection pool is set up correctly in WL 7 SP 7

    Hi all,
    2 questions.
    1) how do i test if the connection pool i set is working? in the testing tab of the jdbc connection pool in the console page, there is a Test Table Name, i entered 'dual' in the text field. After i clicked apply, there is no indication if i set it up correctly.
    2)After i configure the connection pool, do i need to configure the data sources?

    Could you please try using a "Test_When" statement?
    Karthik

  • How do I setup a php testing server that connects to my web host?

    My web host (webhostingpad.com) has php on it. I need to setup a testing server that connects to this so I can test my site locally.
    My questions are:
    1. Do I set this up as a local network connection or an sftp (same as my remote)?
    2. what information do I put in to make this work?

    1024MB is enough to have 2 instances but You have to know what are going to be the requirements levels of those instances in order to check if your memory is enough.
    The memory is a theme that relate Oracle SGA with RAM in the machine.
    To have a second database server you have to make another installation in a different Oracle Home.
    It is not the same to have 2 instances than 2 Oracle database servers.
    Do you know what is the difference ?
    Joel P�rez

  • "connection not available error code - 4161" what...

    Hi
    I have been trying to upload my workouts to Nokia traker but when I start the application I get the following "connection not available error code - 4161" What does this mean and how do I sort it
    Thanks

    I did a comparison, and your connection string is different
    than mine. Mine does not show any password/userid entries, but
    perhaps that's the difference between using SQL and SQL Express.
    (I'm using SQL.) I am, of course, assuming that you have actual
    values for "servername," "database," etc.
    Given that you can't get in from RSC Explorer, it would seem
    that either you are not using the same userid/password as the one
    you set up for the administrator when you created the DB, or else
    there's something wrong with the DB itself.
    Try creating a test DB. Be careful to specify the same
    administrator name and password as the login you use to get on the
    RSC server. After you've created the test DB, open it up from RSC
    Explorer. If you can do this successfully, then everything ought to
    be working OK. From that point, I'd start over and create a new DB,
    and upload to that one. (In fact, I've actually gone through
    exactly that total exercise before.
    G

  • How to do a Generic Connectivity (ODBC) ?

    Hello,
    Generic Connectivity provide Oracle Database to connect another
    database via ODBC. In my case, it is Oracle 8.1.6 which connects
    to Sybase Enterprise 11 on Win NT. The Module "Generic
    Connection" is installed. I view it by the Oracle Universal
    Installer and I have configured the Windows ODBC Manager to
    connect to Sybase.
    This is what I've done step by step:
    1. C:\Oracle\Ora81\hs\Admin\iniths_syb.ora
    HS_FDS_CONNECT_INFO = SPS_NACIONAL
    HS_FDS_TRACE_LEVEL = ON
    HS_FDS_TRACE_FILE_NAME = hs_syb.log
    2. C:\Oracle\Ora81\Network\Admin\Listener.ora
    LISTENER =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = nacional)(PORT = 1521))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = oracle)
    (ORACLE_HOME = c:\Oracle\Ora81)
    (SID_NAME = oracle)
    (SID_DESC =
    (SID_NAME = hs_syb)
    (ORACLE_HOME = c:\Oracle\Ora81)
    (PROGRAM = hs_syb)
    I reload the listener by the following command :
    lsnrctl
    stop
    start
    3. C:\Oracle\Ora81\Network\Admin\Tnsname.ora
    ORACLE =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = oracle)
    hs_syb =
    (DESCRIPTION=
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = 1521))
    (CONNECT_DATA =
    (SID=hs_syb)
    (HS = OK)
    I test the tnsname at the prompt command line :
    tnsping hs_syb
    (It's OK)
    4. Database Link
    CREATE PUBLIC DATABASE LINK syb
    USING 'hs_syb';
    5. Test database link
    select * from emp@syb;
    And Errors occur :
    ORA-28509: unable to establish a connection to non-Oracle system
    ORA-02063: preceding line from SYB
    6. I read again the documentation
    http://technet.oracle.com/doc/oracle8i_816/server.816/a76960/hs_g
    enco.htm
    and I found some tables to be feed with data by the HS_ADMIN
    packtage :
    This is what I have added :
    EXEC DBMS_HS.CREATE_FDS_CLASS ('hs_syb','Uses ODBC Driver')
    EXEC DBMS_HS.CREATE_FDS_INST ('hs_syb','hs_syb','SYC Sybase
    System 10/11')
    EXEC DBMS_HS.CREATE_INST_INIT
    ('hs_syb','hs_syb','HS_DB_NAME','SYBDATA','F')
    (Drop procedure :
    EXEC DBMS_HS.DROP_INST_INIT
    ('hs_syb','hs_syb','HS_FDS_CONNECT_INFO')
    EXEC DBMS_HS.DROP_FDS_INST ('hs_syb','hs_syb')
    EXEC DBMS_HS.DROP_FDS_CLASS ('hs_syb');
    I test one more time the connection,
    And I have the same error message as step 5.
    7. I put in the initialization file (initoracle.ora) the
    parameter
    Hs_Autoregister = true (It is true by default and it doesn't
    change errors. Is it another parameters for HS ?)
    In fact, I don't really understand the notion of "AGENT" for HS
    (Heterogeneous Services) in Oracle. Is it something to enable or
    is it automatic because the iniths_syb.ora file is in the path
    ORACLE_HOME\hs\admin ???
    What is it missing for the Generic Connectivity ? Any
    suggestion ? Say me what is the wrong step in this process or
    what I have forgotten.
    Thank you in advance.
    Jobar Team

    Hello
    You're right, step two needs to set (PROGRAM = hsodbc). I understand this when I saw hsodbc.exe in the path ORACLE_HOME\Bin (and at prompt I try agtctl.exe but without sucess, an utility for Heterogeneous Services).
    Now when I test the connection I can hear Oracle running something.
    This is what I've done step by step (following my previous message)I test with Sybase Entreprise and Sybase Anywhere :
    8. C:\Oracle\Ora81\Database\initoracle.ora
    I set a parameter in init file and I reload Oracle database :
    global_names = false
    OR in SQL+
    alter session set global_names=false;
    WITH SYBASE ENTREPRISE
    9. C:\Oracle\Ora81\hs\Admin\iniths_syb.ora
    At the beginning my iniths_syb.ora file was wrong then I correct parameters by viewing errors in C:\Oracle\Ora81\hs\trace :
    #Using a dsn file generate by the Windows ODBC Manager
    HS_FDS_CONNECT_INFO="FILEDSN=C:\sybase.dsn"
    HS_FDS_TRACE_LEVEL = ON
    HS_FDS_TRACE_FILE_NAME = C:\hs_syb.log
    set SYBASE=C:\\Sybase\\ASE
    Contents of sybase.dsn
    [ODBC]
    DRIVER=Sybase System 11
    UID=USERNAME
    SRVR=SVRNAME
    DB=master
    10. Test Database link
    CREATE PUBLIC DATABASE LINK syb
    CONNECT TO USERNAME IDENTIFIED BY SECRET
    USING 'hs_syb';
    select * from anytable@syb;
    ORA-00942: table or view does not exist
    [Transparent gateway for ODBC]393330(0,0,1[[]])
    ORA-02063: preceding 2 lines from SYB
    I try to set parameters in iniths_syb.ora without success :
    HS_DB_DOMAIN=SVRNAME
    HS_DB_NAME=master
    HS_FDS_DEFAULT_OWNER=USERNAME
    WITH SYBASE ANYWHERE
    11. C:\Oracle\Ora81\hs\Admin\iniths_any.ora
    #Using a dsn file generate by the Windows ODBC Manager
    HS_FDS_CONNECT_INFO="FILEDSN=C:\anywhere.dsn"
    HS_FDS_TRACE_LEVEL = ON
    HS_FDS_TRACE_FILE_NAME = C:\hs_any.log
    Contents of anywhere.dsn
    [ODBC]
    DRIVER=Adaptive Server Anywhere 6.0
    UID=USERNAME
    Integrated=No
    AutoStop=Yes
    EngineName=SERVICE
    12. Test Database link
    CREATE PUBLIC DATABASE LINK anywhere
    CONNECT TO USERNAME IDENTIFIED BY SECRET
    USING 'hs_any';
    select * from anytable@anywhere;
    In SYBASE ANYWHERE I've got this data
    select * from anytable
    go
    dateini col1 col2
    2002-02-01 00:00:00.0000 1.5000 1.4000
    In ORACLE I've got
    SQL> select * from anytable@anywhere;
    dateini col1 col2
    01/02/02 1 1
    There isn't the decimal.
    The reason doesn't like to be 1.4 or 1,4 because in Anywhere and in Oracle It is the same insert "insert into anytable values ('02/02/01', 1.5, 1.4)".
    13. Now I try a select of one column
    select col1 from anytable@anywhere;
    this error occur :
    ORA-00904 invalid column name
    I am sure that this column exist ! "select * from anytable@anywhere;" and "select count(*) from anytable@anywhere;" are OK.
    14. And this doesn't work anymore :
    insert into bx_surcharge@anywhere values ('01/02/02',1,2);
    ORA-02047: cannot join the distributed transaction in progress
    15. Step 6 and 7 doesn't mean to be necessary ? And Where are used parameters of the "ODBC Connectivity Requirements" in the documentation. http://technet.oracle.com/doc/oracle8i_816/server.816/a76960/hs_genco.htm (And How to use Datatype Mapping ?)
    So How to successful a ODBC connection (Maybe I forget some parameters) ? For me, using a connection with ODBC is generic and have to work fine with any type of datasource, isn't it ?
    Have you got any idea to deal ? Thanks a lot.
    Jobar Team

  • How to test a simple PL SQL function from another PL SQL script

    Hi,
    I have created a function. Now i need to test that whether it is returning the correct values or not.
    For that, i have written anothe pl sql script and trying to call this function. Im passing all the IN parameters in that function. I assume here that OUT parameters will provide me the result. Im trying to display the OUT parameter one by one to see my result.
    I'm using toad as sql client here connected with oracle.
    pl sql script:-
    DECLARE
    BEGIN
         DBMS_OUTPUT.PUT_LINE('$$$$$$$ VINOD KUMAR NAIR $$$$$$$');
         FETCH_ORDER_PRODUCT_DATA(320171302, 1006, 6999,
    ODNumber OUT VARCHAR2, Line_Number OUT VARCHAR2,
    ServiceID OUT VARCHAR2, BilltoNumber OUT VARCHAR2,
    AnnualPrice OUT NUMBER, CoverageCode OUT VARCHAR2)
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ODNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | Line_Number );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ServiceID );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | BilltoNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | AnnualPrice );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | CoverageCode );
    END;
    Function:-
    Program Name : SPOT_Order_Product_Data_For_CFS.sql
    Description : Function to Validate parameters from CFS
    By : Vinod Kumar
    Date : 08/19/2011
    Modification History
    By When TAR Description
    CREATE OR REPLACE FUNCTION FETCH_ORDER_PRODUCT_DATA(orderNumber IN VARCHAR2, customerNumber IN VARCHAR2,
    productLine IN VARCHAR2, ODNumber OUT VARCHAR2,
    Line_Number OUT VARCHAR2, ServiceID OUT VARCHAR2,
    BilltoNumber OUT VARCHAR2, AnnualPrice OUT NUMBER,
    CoverageCode OUT VARCHAR2)
    RETURN VARCHAR2 IS
    lv_err_msg VARCHAR2(100) := '';
    lv_bucket_id VARCHAR2(14);
    lv_bill_number VARCHAR2(30);
    lv_anual_price NUMBER;
    lv_coverage_code VARCHAR2(8);
    lv_quote_num NUMBER(10) := NULL;
    lv_line_num NUMBER(5) := 0;
    lv_customer_number VARCHAR2(30) := customerNumber;
    lv_product_id VARCHAR2(14) := productLine;
    lv_count_quote NUMBER := 0;
    lv_quote_status VARCHAR2(5);
    lv_quote_version NUMBER(2):=0;
    BEGIN
    IF INSTR(orderNumber, '-') = 0 THEN
    lv_quote_num := orderNumber;
    ELSE
    lv_quote_num := SPT_Delimiter(orderNumber, 1, '-');
    lv_line_num := SPT_Delimiter(orderNumber, 2, '-');
    END IF;
    --Check status of the quote COM, APP
    SELECT COUNT(*) INTO lv_count_quote FROM sot_order_header WHERE ORDER_NUMBER=lv_quote_num
    AND ORDER_STATUS IN ('APP', 'COM') AND CUSTOMER_NUMBER = lv_customer_number;
    IF lv_count_quote = 0 THEN
    lv_err_msg := 'Invalid Order number';
    RETURN lv_err_msg;
    END IF;
    -- Fetch the latest version on SPOT quote
    SELECT MAX(VERSION_NUMBER) INTO lv_quote_version FROM SPT_QUOTE_HEADER WHERE QUOTE_NUMBER = lv_quote_num
    AND CUSTOMER_NUMBER = lv_customer_number;
    -- If quote is valid fetch the data in OUT parameters
    IF lv_line_num = 0 THEN
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.LINE_NUMBER, b.BUCKET_ID,
    b.ANNUAL_REF_RATE_USD, b.COVERAGE_CODE
    INTO lv_bill_number,lv_line_num,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
    lv_err_msg := 'Multiple PIDs existing in the SPOT order, please provide the SPOT order + line number as input data';
    RETURN lv_err_msg;
    END;
    ELSE
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.BUCKET_ID, b.ANNUAL_REF_RATE_USD,
    b.COVERAGE_CODE
    INTO lv_bill_number,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id
    AND b.LINE_NUMBER = lv_line_num;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
              lv_err_msg := 'Multiple SPOT lines exist with same parameter';
              RETURN lv_err_msg;
    END;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    lv_err_msg := '@@@ EXCEPTION THROWN @@@ '|| SUBSTR(SQLERRM,1,120);
    RETURN lv_err_msg ;
    END;
    Don't look at the function, it might have errors but my primary concern is how to test this function. Once I start doing its testing then only i can understand any bugs(if any).
    My pl sql is not so good. Im still learning. I don't understand IN and OUT parameters are.
    I just know that IN parameters r those whick we pass in to the function wen we call it and OUT parameters are those through which we get the result.
    Thanks in advance
    Vinod Kumar Nair

    20100511 wrote:
    I wondered how I could test the output of the function from within TOAD?I usually create the following function in my developer schema:
    create or replace function BoolToChar( b boolean ) return varchar2 is
    begin
      if b then
        return( 'TRUE' );
      else
        return( 'FALSE' );
      end if;
    end;To test a function like yours, the following will do in SQL*Plus/TOAD/etc:
    begin
      DBMS_OUTPUT.put_line(
        BoolToChar( XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934)  )
    end;
    I'm probably doing 101 things wrong here, but thought I'd ask anyway and risk being shouted at.Shout at? You reckon? I thought people risked being beaten with a lead pipe, or pelted with beer cans and stale pretzels - which makes being shouted at a really safe and viable alternative. {noformat};-){noformat}

  • How to test domain controller on upgraded Win Server 2008 R2

    The windows team recently upgraded the development environment for the domain controller from 2003 to Windows 2008 R2 and I am to test the Idm functionality on this upgraded version. Our current configuration is that the DC and Idm gateway runs on different machines. To test this new DC, i want to install the idm gateway on that server and run some onboarding and termination test cases just to make sure if the AD connection is working on the upgraded DC. But i am getting ’Input/output error’ when i try to install the service and from the documentation it says 'The most common cause of this is that you do not have rights to work with this service.'. The server admin tried installing the gateway with his id as well and it failed. He tested installing in on the 2003 version of DC and it worked, so its not a matter of permission (i think..)...
    Does anyone have any better idea on how to test an upgrade of a DC from version 2003 to 2008 R2? Any help in this matter is appreciated. We are running Idm 8.1 on a Windows platform and an upgrade to OW 8.1.1. Patch 2 is also in the works..
    Thanks in advance.

    I may have found a workaround. Can you try to change the "compatibility mode" in 2008 R2 to "Windows XP SP3" and see if it will install?
    Admittedly I have not done this myself so I'm not entirely sure where or how it's done, but I have confirmation it resolves the issue from others who have faced it.

Maybe you are looking for

  • Extracting doc number information from dox saved in DMS

    Hello, I'm wanting to have a macro written that will put a document id into the footer of saved documents when the appropriate button is pushed. I know I can use the standard Word "Insert | Autotext | Header/Footer | Filename or Filename and path but

  • SC (SRM) = PO (BE) with limit item (Itm.Cat = B)

    Dear all, in SRM I create a SC with two items, the first item is quit normal (material, cost center assignment, etc). The second item is a copy of the first one, unit of measure is LE. Now when this SC is transfered into the BE I want the PO to conta

  • Print Setup says use Adobe Color Printer with No Color Management even though I have my .icc printer profile selected

    I have a ColorMunki Photo and a Canon Pixma Pro 100 that I have been using on my Mac with Photoshop CC.  No issues.  I must have changed something because now when I go to print, a popup says "Please use Adobe Color Printer Utility if you need to pri

  • Linking the EditText to a field

    Hi experts, can it be possible to link a created edittext field from UI to a specific table field. this is my scenario i have created a edit text field in SALES ORDER MODULE when i place a value on that field it must be save to the Table of SALES ORD

  • Error message and refining program!

    hI Im getting this error message can anyone help on whats going wrong here? any help appreciated Paul Enter the item part number: 10001 Enter the date of sales dd-Mmm-yyyy: 11-Apr-2003 Exception in thread "main" java.io.FileNotFoundException: 10001 (