Couldn't connect to database?

Hello
I am trying to connect to sqlserver2000 database thru JDBC & JSP. I think it loaded the driver but cannot connect to database. I have installed sqlserver2000 in my machine, web server is tomcat 4.1.
This is the code.
<%@ page language="java" %>
<%@ page import = "java.sql.*" %>
<HTML>
<BODY>
<%
try {           
     // Load the JDBC driver
     Class.forName ("com.jnetdirect.jsql.JSQLDriver");
// Create a connection to the database
Connection connection = DriverManager.getConnection("jdbc:JSQLConnect://admin:1433","sa","");
     Statement stmt=connection.createStatement();
          catch (ClassNotFoundException e)
System.out.println("Could not find the database driver");
          catch (SQLException e)      
System.out.println("Could not connect to the database");
%>
</BODY>
</HTML>
It displays "Could not connect to the database" but "Could not find the database driver" is not display that means database driver is loaded. So what wrong?

Most probably your URL is screwed.
In order to find out in your catch statement add this code:
catch (SQLException e)
System.out.println("Could not connect to the database");
System.out.println("Error = " + e.getMessage());
e.printStackTrace(System.out);
That will give you the reason for the error, and the exact place that it occurred.
Both of those are invaluable bits of info when it comes to debugging.
My call would be to replace "admin" in your connection string with the IP address of the sql server, and see if that works.
Good luck,
evnafets

Similar Messages

  • FCS DB backup failed w/error: "couldn't connect to database "template1"

    Hi,
    I am testing two different FCS systems (on two different machines, the same config).
    I wanted to backup FCS on one machine manually and it was not possible. I tried to do the same on the second machine and it was also not possible. I checked logs for automatic backup on both machines and everything worked until 22nd of April.
    I am not sure if I did download some update, but I am sure I didn't change anything on both machines nor FCS settings.
    I got this error message when I tried to backup:
    *Backup failed: pg_dumpall exited with code 1.*
    *Checking for other backup processes...*
    *Starting database backup to path '/Volumes/ProxyA/FCSBackups/Final Cut Server DB Backup on fcserver-1 at 2009-04-23 0000.zip'...*
    *pg_dumpall: could not connect to database "template1": could not connect to server: Connection refused*
    *Is the server running locally and accepting*
    *connections on Unix domain socket "/tmp/.s.PGSQL.5433"?*
    Both systems work normally. I "just" can't backup the DB.
    What happened ?
    Thank you.

    Hi Sam,
    Sometimes it is only because you have not set the environment correctly (ORACLE_HOME, ORACLE_SID).
    Is your TNSNAMES.ORA correct?
    If you do a "ps -ef |grep oracle" you should get a list of processes. Make sure you see PMON and SMON processes as well as the LSNR processes.
    If you don't see the LSNR processes start the listener.
    If this don't help try to start the DB manually and check with tsnping, otherwise come back again with mor info.
    regards
    Wolfgang

  • Couldn't connected to database 10g

    Hi all,
    I have oracle home with Tnsname.ora file specified net_service_name
    to connect both database version 9i and 10g ,so when I connect to database 9i
    by SQL * Plus ,it's ok but when try to connect to database 10g ,it does not work
    and SQL * Plus show error message "ORA-12203: TNS:unable to connect to destination" ,if I change home selector to the other home ;such as Discoverer home ,it can connect to database 10g but some eariler oracle 16-bit application
    like OFSA can not use.
    Thank you
    Mcka

    12203, 00000, "TNS:unable to connect to destination"
    // *Cause: Invalid TNS address supplied or destination is not listening.
    // This error can also occur because of underlying network transport
    // problems.
    // *Action: Verify that the service name you entered on the command line
    // was correct. Ensure that the listener is running at the remote node and
    // that the ADDRESS parameters specified in TNSNAMES.ORA are correct.
    // Finally, check that all Interchanges needed to make the connection are
    // up and running.

  • Couldn't connect to source database

    Hi All,
    Need some help, currently we used Oracle Business Intelligence 10.1.3.4.1 already live since 1 year ago and working fine. but suddenly my source database(oracle 10g) have problem,
    and get re-strated. after source database get re-started our obiee apps couldn't connect to our source database.
    it's always hanging when we try to open report dashboard or answer, even we already re-start obiee services.
    in our log we on see this error and there is no other clue.
    "[nQSError: 12002] Socket communication error at call=recv: (Number=104) Connection reset by peer"
    I'm already search in google for the solution, but it's not working.
    1. changing connection from ODBC to OCI
    2. check manual connection through sqlplus " it's ok"
    3. restart services
    4. check env param
    fyi, our connection pool is using oci 10g.

    Hi,
    Take the backup of RPD and catlog.
    Uninstall OBI 10g and install it again.
    config again, it will work.
    Its seems some of the config file of obi has got corrupted.
    Thanks
    Nagu

  • Com.sap.inst.jload.Jload main SVERE: couldn't connect to DB

    Hi,
    I'm having this problem when installing SAP NW04 WebAS 6.40 Java system on Solaris 10. Database is up and running. And i've applied this patch as well.
    "SCSCLIENT64UC_5-20000121.SAR"
    java version "1.4.2_12"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
    Oct 27, 2006 4:36:07 PM com.sap.inst.jload.Jload main
    INFO: Jload -sec SDN,jdbc/pool/SDN,/sapmnt/SDN/global/security/data/SecStore.properties,/sapmnt/SDN/global/security/data/SecStore.key -dataDir /export/home/sap/images/sap-nw04-support-release1-webasjava-nwdeveloperstudio-igs/J2EE_OSINDEP/J2EE-ENG/JDMP -job /tmp/sapinst_instdir/NW04SR1/WEBAS_JAVA/CENTRAL/ONE_HOST/IMPORT.XML -log /tmp/sapinst_instdir/NW04SR1/WEBAS_JAVA/CENTRAL/ONE_HOST/jload.log
    Oct 27, 2006 4:36:10 PM com.sap.inst.jload.Jload main
    SEVERE: couldn't connect to DB
    java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    Thanks,
    Torpedo

    Hi,
      I am also facing this same issue .
       Can somebody pls tell me how do i check the listner status and or /etc/hosts file
      Or any other help for this error ?
    Thanks,
    Suman

  • How to connect one database in two threads?

    Dear All,
    If anyone can tell me how to connect one database concurrently?
    I tried the following idea:
    1.create a Hashtable to keep database objects(those databases have been opened)
    2.Before openning(connecting) a database:first step is to check the hashtable.
    If the the database object is in the hashtable, this object will be returned.
    If the datatbase object is not in the hastable, open the database and store this opened database object into the hashtable.
    I failed the test of this implementation. My test is:Create two threads (extend java Thread class).In each of these two threads, try to open the same database.Just like the following:
    MyThread thread1 = new MyThread();
    MyThread thread2 = new MyThread();
    thread1.start();
    thread2.start();
    I guessed the database object in the hashtable would be returned in the second thread.Unfortunatly, I only got an exception which meant the database couldn't be opened twice.It looks like the second thread happened before the opened database object stored into the hashtable.
    I cannot figure out if my design is wrong or my test application is wrong.
    I really appriatiate your attentions!!!
    Lu

    um not sure i follow exactly but in your code add the word synchronise to it and this means only 1 tread can access it at any 1 time.
    So your could have a class which is a singleton so it only opens the dbase once and then all other access share your connection.
    so
    public class foo{
    foo INSTANCE = new foo();
    private foo(){} //private constructor
    then all your methods use foo's internal dbase connection. Am i making sense

  • Error connecting to database - java.sql.SQLException: Io exception: The Net

    Hello friends,
    I know this question has been asked in a lot of other threads; but my problem is quite unique and that's why I'm starting a new thread...
    When I try to access an Oracle 10g database through a Servlet code using a JDBC thin driver (both Tomcat and the database are running on Solaris 9), I get the following error:
    "Error connecting to database - java.sql.SQLException: Io exception: The Network Adapter could not establish the connection"
    However, there is another application running on the same server using the same database server (only the actual databases being used differ) and it is able to access the database without any issues. Both of these are absolutely similar applications and I couldn't think of any reasons why one would work and the other wouldn't. I thought they might be conflicting each other and tried running only the problematic application. But even then, I get the same error.
    I know this might not be too relevant but to provide you some more information on the environment, the applications are running on separate Tomcat instances on the same server and they are connected to an Apache web server through Mod jk.
    Any help in solving this problem is greatly appreciated!
    Thanks!
    Regards,
    Yogaesh

    Yogaesh wrote:
    The 'application' that works is also a Tomcat application... It's exactly same as the problematic application in terms of the configuration and stuff... As for the typo errors, I copied the config info and pasted it... So pretty much it should be the same. And to add an additional note, I'm able to connect to the database from my localhost... I mean if I run the problematic application from localhost (without Apache and directly hitting Tomcat) I'm able to access the screens...
    The second part of that (localhost) usually isn't all that useful. You know it is a connection failure so that means the code is running and technically successfully (since connection failure is a legitimate runtime error.)
    You know it isn't a firewall issue because it connects from another app in tomcat. So it must be a configuration issue.
    So something like one of the following.
    1. It isn't the same (we already know this but this particular item means that it is not in fact exactly the same because you deliberately or accidently modified it.)
    2. It isn't pulling the right config. Maybe you aren't packaging it, maybe it is buffered on the server and it is using that rather than what you think it is.
    3. Java code is referring to the wrong name.
    Do this, change the configuration so it points to a server that does not exist. Repack, redeploy. If the error is the same (no diff) then you know that it is not running the code that you think it is. If it does change then you know that it can only be 1.

  • Restoring to an Alternate Mailbox - Couldn't connect to the source mailbox

    I am trying to restore a deleted mailbox from a couple years ago and the AD User Object no longer exists.  I restore from tape and create a recovery database.  I use the command
    "New-MailboxRestoreRequest -SourceDatabase RecoveryDB -SourceStoreMailbox 'User name' -TargetMailbox administrator -TargetRootFolder Restore -AllowLegacyDNMismatch"
    and I receive error "Couldn't connect to the source mailbox".

    Hi
    I got result in mail box & i can sow the mail box. I successful  recover existing mailbox ,  But can not recover to AD User Objects are not mailboxes 

  • Forms 6 not connecting with Database 10g

    I can not connect Oracle forms 6 with database 10g

    795192 wrote:
    I can connect to sql plus but i cannot connect my forms 6 with database 10g. getting the following error:
    ORA-12154: TNS: could not resolve service name=================================
    ORA-12154: TNS:could not resolve the connect identifier specified
    This error means one thing, and one thing only. The client could not find the specified entry in the tnsnames.ora file being used.
    As a follow-on to that statement, remember that when you use a dblink, the database in which the link is defined is acting as a client to the database that is the target of the link. So in this case, the tnsnames.ora file on the host of your source should have an entry for your target db, as defined in the db_link.
    And for the umpteenth time ... this error has <b><i><u>NOTHING</u></i></b> to do with the status of a listener. The connection request never got far enough to reach a listener. If anyone tells you to check a listener in response to ora-12154, they are not paying attention, or do not understand how TNS works. This error is the equivalent of not being able to place a telephone call because you don't know the number of the party you want to reach. You wouldn't debug that situation by going to the other guy's house and testing his telephone, or by going to the phone company and testing the switchboard. And you don't debug a ORA-12154 by checking the listener. If I had a top ten list of "Incredibly Simple Concepts (tm)" that should be burned into the brain of everyone who claims to be an Oracle DBA, it would include "ORA-12154 Has Nothing To Do With The Listener".
    =================================
    A couple of important points.
    First, the listener is a server side only process. It's entire purpose in life is to receive requests for connections to databases and set up those connections. Once the connection is established, the listener is out of the picture. It creates the connection. It doesn't sustain the connection. One listener, with the default name of LISTENER, running from one oracle home, listening on a single port, will serve multiple database instances of multiple versions running from multiple homes. It is an unnecessary complexity to try to have multiple listeners or to name the listener as if it belongs to a particular database. That would be like the telephone company building a separate switchboard for each customer.
    Second, the tnsnames.ora file is a client side issue. It's purpose is for address resolution - the tns equivalent of the 'hosts' file further down the network stack. The only reason it exists on a host machine is because that machine can also run client processes.
    Assume you have the following in your tnsnames.ora:
    larry =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVICE_NAME = curley)
      )Now, when you issue a connect, say like this:
    $> sqlplus scott/tiger@larrytns will look in your tnsnames.ora for an entry called 'larry'. Next, tns sends a request to (PORT = 1521) on (HOST = myhost) using (PROTOCOL = TCP), asking for a connection to (SERVICE_NAME = curley).
    Where is (HOST = myhost) on the network? When the request gets passed from tns to the next layer in the network stack, the name 'myhost' will get resolved to an IP address, either via a local 'hosts' file, via DNS, or possibly other less used mechanisms. You can also hard-code the ip address (HOST = 123.456.789.101) in the tnsnames.ora.
    Next, the request arrives at port 1521 on myhost. Hopefully, there is a listener on myhost configured to listen on port 1521, and that listener knows about SERVICE_NAME = curley. If so, you'll be connected.
    What can go wrong?
    First, there may not be an entry for 'larry' in your tnsnames. In that case you get "ORA-12154: TNS:could not resolve the connect identifier specified" No need to go looking for a problem on the host, with the listener, etc. If you can't place a telephone call because you don't know the number (can't find your telephone directory (tnsnames.ora) or can't find the party you are looking for listed in it (no entry for larry)) you don't look for problems at the telephone switchboard.
    Maybe the entry for larry was found, but myhost couldn't be resolved to an IP address (say there was no entry for myhost in the local hosts file). This will result in "ORA-12545: Connect failed because target host or object does not exist"
    Maybe there was an entry for myserver in the local hosts file, but it specified a bad IP address. This will result in "ORA-12545: Connect failed because target host or object does not exist"
    Maybe the IP was good, but there is no listener running: "ORA-12541: TNS:no listener"
    Maybe the IP was good, there is a listener at myhost, but it is listening on a different port. "ORA-12560: TNS:protocol adapter error"
    Maybe the IP was good, there is a listener at myhost, it is listening on the specified port, but doesn't know about SERVICE_NAME = curley. "ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"
    =====================================

  • Couldn't Connect to the source mailbox - New-MailboxRestoreRequest

    Having major issues with recovering a mailbox for a user, we have created a recovery mailbox db and it's mounted fine and not in a dirty shutdown state, but when I try any variations of  'New-MailboxRestoreRequest' I get the below message:
    New-MailboxRestoreRequest -SourceDatabase "RDB18" -SourceStoreMailbox "roger Hodges" -TargetMailbox otest -AllowLegacyDNMismatch
    Couldn't connect to the source mailbox.
        + CategoryInfo          : NotSpecified: (0:Int32) [New-MailboxRestoreRequest], RemotePermanentException
        + FullyQualifiedErrorId : 3E0814F2,Microsoft.Exchange.Management.RecipientTasks.NewMailboxRestoreRequest
    I've tried Restore-Mailbox also and get the below error:
    Restore-Mailbox -Identity "otest" -RecoveryDatabase "RDB18" -RecoveryMailbox "Roger Hodges" -TargetFolder Recovery
    Confirm
    Are you sure you want to perform this action?
    Recovering mailbox content from mailbox 'Roger Hodges' in the recovery database 'RDB18' to the mailbox for 'OWA Test
    ([email protected])'. This operation may take a long time to complete.
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): a
    Error was found for OWA Test ([email protected]) because: Error occurred in the step: Opening source mailbox.
     Failed to open mailbox by GUID with error: An unknown error has occurred., error code: -1056749260
        + CategoryInfo          : InvalidOperation: (0:Int32) [Restore-Mailbox], RecipientTaskException
        + FullyQualifiedErrorId : A9E3B394,Microsoft.Exchange.Management.RecipientTasks.RestoreMailbox

    Hi,
    Please try the following command to check this issue:
    New-MailboxRestoreRequest -SourceDatabase "RDB18" -SourceStoreMailbox "roger Hodges" -TargetMailbox otest -
    TargetRootFolder “folder name” –AllowLegacyDNMismatch
    In addition, when running this cmdlet, the source mailbox in the recovery database needs to be identified using one of three possible values: the
    DisplayName,
    MailboxGUID, or
    LegacyExchangeDN values. Keep in mind that you cannot reference the source mailbox using the Exchange Alias when performing a restore. You can use
    Get-MailboxStatistics cmdlet to find this information.
    Best Regards.

  • Portal not starting - Error: Couldn't connect to DB

    Hi
    I have installed a WAS ABAP 6.40 stack running on AIX 5.2 and Oracle 9.2.0.6. I then successfully installed a JAVA add-on stack. I then successfully installed a portal.
    The portal was working fine, I could successfully logon to it via the url http://<fully qualified hostname>:58400/irj (84 being my instance number)
    Now the portal no longer works. Some investigation has found that my J2EE engine is no longer starting.
    When I enter the command startsap as <sid>adm, I see the following:
    Checking BWD Database
    J2EE Database is not available via  test
    See logfile JdbcCon.log
    Below is an extract from the file /home/<sid>adm/JdbCcon.log
    Error: Couldn't connect to DB
    java.sql.SQLException: ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    IBM AIX RISC System/6000 Error: 2: No such file or directory
    Also from the log file /usr/sap/<SID>/DVEBMGS84/work/std_server0.out I can see the following:
    <SAP J2EE Engine Version 6.40 PatchLevel 87289.311 is shutting down!>
    If anyone can advise, it would be greatly appreciated.
    Regards
    Sam

    Hi Sam,
    Sometimes it is only because you have not set the environment correctly (ORACLE_HOME, ORACLE_SID).
    Is your TNSNAMES.ORA correct?
    If you do a "ps -ef |grep oracle" you should get a list of processes. Make sure you see PMON and SMON processes as well as the LSNR processes.
    If you don't see the LSNR processes start the listener.
    If this don't help try to start the DB manually and check with tsnping, otherwise come back again with mor info.
    regards
    Wolfgang

  • Code to connect to database in  Webdynpro-- iviews

    Hi All-
    Could you let me know the code to connect to database
    in WebDynPro-->iviews.
    Regards,
    Cris

    Hi,
    Here are the two ways of connecting to a database through coding:
    ////1////
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
              java.sql.Connection conn= java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://<IP>:<port>;user=<abc>;password=<xyz>;database=<DB name>");
    ////2////     
    InitialContext initialContext = new InitialContext();
    DataSource dataSource = (DataSource)initialContext.lookup("jdbc/SRI");
    java.sql.Connection conn = dataSource.getConnection();
    Regards
    Srinivasan T

  • How to find the number of users  connected to database from OS level(Linux)

    Hi All,
    Could anyone know , how to find the number of users connected to database without connecting with sql*plus
    is there any command to find it?
    example we have 10 databases in one server, how to find the number of users connected to particular database without connecting to database(v$session)?
    oracle version:- 10g,11g
    Operating System:- OEL4/OEL5/AIX/Solaris
    any help will be appreciated.
    Thanks in advance.
    Thank you.
    Regards,
    Rajesh.

    Excellent.
    Tested, works as long as you set the ORACLE_SID first ( to change databases )
    ps -ef | grep $ORACLE_SID | grep "LOCAL=NO" | awk '{print $2}' | wc -l
    Thanks!
    select OSUSER
        from V$SESSION
    where AUDSID = SYS_CONTEXT('userenv','sessionid')
        and rownum=1;Best Regards
    mseberg

  • Windows 8.1 - Windows Couldn't connect to the System Event Notification Service service

    I have an issue that has been bothering me for a while on new 8.1 computers. Standard users are not able to log into the computer on the first try consistently. They receive the error message: Group Policy client service failed the sign-in access is
    denied. They are stuck at the logon screen.
    If an administrator logs in (local or domain), they can log in but get a black desktop with two error messages. The first is Location is Not available - C:\Windows\system32\config\systemprofile\Desktop is unavailable. The second error message is a popup
    balloon. It states "Failed to Connect to a Windows service. Windows couldn't connect to the System Event Notification Service service."
    When a standard user attempts to log in, event viewer records three warnings. They are listed in order from oldest to newest
    The winlogon notification subscriber <Profiles> was unavailable to handle a critical notification event. -Logged 9:14:44
    The winlogon notification subscriber <GPClient> failed a critical notification event. - Logged 9:14:44
    The winlogon notification subscriber <Profiles> was unavailable to handle a notification event. - Logged 9:14:49
    After a reboot, users still have the issue. I noticed that the user profile services and system event notification service are not running though their startup type is automatic. They start after a minute or two.

    Hi Joseph__Moody,
    Based on your description ,I assume it is a domain environment .First of all ,I would suggest you to try to update all the machine .
    "I have an issue that has been bothering me for a while on new 8.1 computers"
    Do you mean all the Windows 8.1 machine share the same symptom or just a specific one ?Did the machine work correctly before ?When did the issue start to occur ?Have you installed any third party software before ?Can we operate the machine when we login with
    an administrator account ?
    If the issue occurred with the specific machine :
    "The first is Location is Not available - C:\Windows\system32\config\systemprofile\Desktop is unavailable."
    Please try the following suggestions if we can operate the machine when we login with the administrator account :
    Open Windows Explorer and navigate to: C:\Windows\system32\config\systemprofile and verify if it has the Desktop folder there.If the folder doesn`t exit, we can copy from C:\users\Default\Desktop location(This folder is hidden by default).
    We also can try the following suggestions to have a troubleshoot :
    1.Run "sfc /scannow"or "dism /online /cleanup-image /restorehealth" to check the health of the system files.
    2.Perform a full scan with an antivirus software.
    3."They start after a minute or two."
    I suspect there is a third party service confilct here. Please perform a clean boot to verify whether there is a third party conflict here .
    How to perform a clean boot in Windows
    https://support.microsoft.com/en-us/kb/929135
    If the issue occurred with multiple machines in the domian ,I would suggest you to check whether you have configured any logon scripts and logon group policy .We can remove the machine from the domain to have  a troubleshoot .
    If the issue occurred recently ,we can perform a system restore to recover the machine to a previous normal point.
    Best regards
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].

  • I am not able to connect to database in sql developer.how to do?

    I downloaded sqldeveloper 1.5.4.59.40. iam not able to establish connection to database. Can anyone tell me ?

    Have you created a database (or have one you connect to)?
    Have you created the Net Service connections for SQL Developer to use?
    Does SQL Developer have access to this Net Serviice name?
    Have you created the connections from SQL Developer?
    Can you post an error message?
    See
    <br>
    Oracle Database FAQs
    </br>

Maybe you are looking for

  • Error while building VSM

    I've setup the build environment for the VSM, but I can't get the VSM.ear to deploy in OC4J. Here is what I see when I build: Buildfile: build.xml init: copy: compile: [unjar] Expanding: E:\oc4j\lib\oraclexsql.jar into E:\vsm-i18n\classes [unjar] Exp

  • [HELP!]open a pop-up and lock the window

    Hi guys, the thing is : In a page (call it P1), when click a button there will come a pop-up page(P2), when P2 shows, P1 is locked, user can not perform any action on P1. the point is, P2 is not a real pop-up, it's inside the same window as P1. just

  • I can't burn DVD's on DVD Studio Pro since I install Snow Leopard

    Well, my computer was working great, I had tiger installed and I decided to update to snow leopard and "big mistake" since then I haven't been able to burn DVD's from DVD Studio Pro, at the time to start writing the information to burn it, it shows a

  • Error in adding selection screen fields

    Hi All,, I am getting error when i add a selection screen parameters in module pool. I copied stadard program to custom one, when I add an input field to screen it gives information message saying "Selection screen: Report generation makes screen cha

  • Data Refesh does not support script only queries

    I created a Power Query transformation that does not contain any data source because it generates a fixed table (imagine a Date Table, with certain columns marked based on current day value). I receive this alert trying to create the data source: Dis