Results 1 to 5 of 5

Thread: connection fail

  1. #1
    dixit.ashish is offline Member
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    0

    Smile connection fail

    hi,i am new in java.I have a problem to connect sqlserver2008 by using odbc connector from my projects.login page open then i give correct username and password but my home page is not open and give exception in log file in tomcat5.5.plg help me urgently. thanks

    [JPivot] 01 Feb 2010 13:45:56,833 ERROR [Session ] org.apache.catalina.realm.JDBCRealm#start: Exception opening database connection
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the named instance has failed. Error: java.net.SocketTimeoutException: Receive timed out.
    at com.microsoft.sqlserver.jdbc.SQLServerException.ma keFromDriverError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.g etInstancePort(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnect(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(Unknown Source)
    at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm .java:701)
    at org.apache.catalina.realm.JDBCRealm.start(JDBCReal m.java:769)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4126)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:760)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:740)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:544)
    at org.apache.catalina.startup.HostConfig.deployDirec tory(HostConfig.java:920)
    at org.apache.catalina.startup.HostConfig.deployDirec tories(HostConfig.java:883)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:492)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1138)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:120)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1022)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:448)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:700)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:552)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:295)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:433)
    [JPivot] 01 Feb 2010 13:46:08,213 ERROR [Session ] org.apache.catalina.realm.JDBCRealm#start: Exception opening database connection
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the named instance has failed. Error: java.net.SocketTimeoutException: Receive timed out.
    at com.microsoft.sqlserver.jdbc.SQLServerException.ma keFromDriverError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.g etInstancePort(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnect(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(Unknown Source)
    at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm .java:701)
    at org.apache.catalina.realm.JDBCRealm.start(JDBCReal m.java:769)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4126)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:760)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:740)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:544)
    at org.apache.catalina.startup.HostConfig.deployDirec tory(HostConfig.java:920)
    at org.apache.catalina.startup.HostConfig.deployDirec tories(HostConfig.java:883)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:492)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1138)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:120)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1022)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:448)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:700)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:552)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:295)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:433)
    [JPivot] 01 Feb 2010 13:46:39,105 ERROR [Session ] org.apache.catalina.realm.JDBCRealm#authenticate: Exception performing authentication
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the named instance has failed. Error: java.net.SocketTimeoutException: Receive timed out.
    at com.microsoft.sqlserver.jdbc.SQLServerException.ma keFromDriverError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.g etInstancePort(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnect(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(Unknown Source)
    at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm .java:701)
    at org.apache.catalina.realm.JDBCRealm.authenticate(J DBCRealm.java:346)
    at org.apache.catalina.authenticator.FormAuthenticato r.authenticate(FormAuthenticator.java:258)
    at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:417)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:870)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:685)
    at java.lang.Thread.run(Unknown Source)

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Sounds like a firewall or network routing problem.

  3. #3
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    Why are you connecting over odbc anyway?

    If you change you mind use this little tutorial with troubleshooter
    to connect to Microsoft SQL Server 2008 using JDBC Driver.

    Getting Processing working with SQL Server 2008 « Tim’s Zen Blog of Sparseness

    If you stay on odbc, first resolve network issues.

    On which port is server running (default 1433 or different)
    Use this in command prompt first (or change IP and port):
    Java Code:
    telnet 127.0.0.1 1433
    to see if you can connect.

    If you don't know what port is port and cannot connect,
    here is how you will find out:

    Finding the Port Number for a particular SQL Server Instance « Systems Engineering and RDBMS


    Other issues:
    What Authentication type you use: Windows authenitacion or
    SQL server auth (with username and pass). You have use this credentials
    when connecting to server.

    You have to know if server is using static or dynamic port
    (this is for 'express edition' i don't know for full version).
    Use sql server configuration manager to fix this.

    If you create that odbc using windows ODBC datasource administrator wizard
    can you connect in last step to datasource you just created?

  4. #4
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    There is another driver for SQL Server:

    jTDS JDBC Driver

    Java Code:
    ...Class.forName("net.sourceforge.jtds.jdbc.Driver")...
    You can try using this one and here is a troubleshooting guide from related site about Connection refused: says:

    "The server name is misspelled or the port number is incorrect.

    SQL Server is not configured to use TCP/IP.
    Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).

    There is a firewall blocking port 1433 on the server."


    Any luck with this or your first driver?

  5. #5
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    I got my network connection up and running,
    so i posted little tutorial on this issue

    Tutorial candidate: Java connection to ms sql server 2005 express

    please check it out :)

Similar Threads

  1. Replies: 7
    Last Post: 10-20-2009, 11:34 AM
  2. getImage - not fail when image doesn't exist
    By leonid.ge in forum Java Applets
    Replies: 0
    Last Post: 07-24-2009, 04:17 PM
  3. Replies: 5
    Last Post: 03-26-2009, 07:24 AM
  4. jsessionid imbedded in link causes it to fail
    By dkirvan in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-10-2008, 10:25 PM
  5. Replies: 5
    Last Post: 10-25-2008, 09:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •