Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7493465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:58:28+00:00 2026-05-29T16:58:28+00:00

java.sql.SQLException: Network error IOException: Connection timed out: connect at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:410) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)

  • 0

java.sql.SQLException: Network error IOException: Connection timed out: connect at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:410) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at mahesh.MyFrame.connectToServer(MyFrame.java:50) at mahesh.DataCount.main(DataCount.java:18) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:307) at net.sourceforge.jtds.jdbc.SharedSocket.(SharedSocket.java:257) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:311) … 6 more

Can anyone help me in getting rid of this exception?

here is my java code

**Class.forName(“net.sourceforge.jtds.jdbc.Driver”);

Connection connection = DriverManager.getConnection(“jdbc:jtds:sqlserver://mindmill:1433/employ”,”mahesh”,”mahesh”);**

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:58:33+00:00Added an answer on May 29, 2026 at 4:58 pm

    As the jTDS FAQ states, the URL must be in the form

    jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
    

    Infering from your connection:

    • mindmill is the name of your_computer/server where Sql Server 2005 is installed.
    • 1433 is the (default) port to connect with Sql Server 2005.
    • employ is the database name.
    • mahesh is your user and password to connect to server.

    From here on, you must set other sql connection parameters. I’ll post you my code:

    package edu.jtds.main;
    
    import java.sql.*;
    
    public class SqlServerConnTest {
    
        Connection conn;
    
        public void connect() {
            try {
                Class.forName("net.sourceforge.jtds.jdbc.Driver");
                String dbName = "TestDB";
                String user = "cajeroUpz";
                String password = "cajero";
                //the name of my SQL SERVER 2005 instance
                String SqlServerInstance = "instance=SQL2005";
                String url = "jdbc:jtds:sqlserver://localhost:1433";
                url = url + "/" + dbName;
                url = url + ";" + SqlServerInstance;
                conn = DriverManager.getConnection(url, user, password);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
        public Connection getConnection() {
            return this.conn;
        }
    
        public static void main(String[] args) {
            SqlServerConnTest oSqlServerConnTest = new SqlServerConnTest();
            oSqlServerConnTest.connect();
            String sql = "SELECT * FROM TEST_TABLE";
            Connection conn = null;
            Statement stat = null;
            ResultSet rs = null;
            try {
                conn = oSqlServerConnTest.getConnection(); 
                stat = conn.createStatement();
                rs = stat.executeQuery(sql);
                while(rs.next()) {
                    System.out.println(String.format("%d %s", 
                        rs.getInt(1), rs.getString(2)));
                }
                rs.close();
                stat.close();
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    The output of my program:

    1 hello world
    2 goodbye!
    

    The lessons here:

    1. From SQL Server 2005 and on, you must set the name of the instance (like the example above).
    2. In SQL Server, you must check that your TCP/IP protocol is enabled and the communication port is 1433 (this last is setted by default, just check it). You can enable/disable using SQL Server Configuration Management in the SQL Server 2005 Configuration Tools.

    Checking TCP/IP protocol for SQL Server 2005

    Any other problems, just tell me.

    EDIT:

    The best case would be if you have already tried this connection with your pc as a Server, I mean your pc must have Sql Server 2005 installed, NetBeans installed and the project already setted up and running (as a proof of concept to connect the database).

    Even if you haven’t do the step before, there is a set of questions you should have answered before trying to connect a remote server:

    1. Have you checked communication between your pc and the host? In your case, prompt a Command Line (Start / Run… type ‘cmd’ and Enter) and enter the command “ping mindmill”, check the hostname of your server.
    2. Have you installed Sql Server Management Studio in your pc and connected to your server? does your server allow remote connections? Help 1
    3. Does the user have enough privileges to connect the database? Help 2

    Let me know any more issues after you have answered this questions before.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLException: Closed Connection I
I am getting the following error: java.sql.SQLException: Exhausted Resultset at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at
Reasons for java.sql.SQLException: Closed Connection from Oracle?? java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
I get the following error when working on some JDBC code: java.sql.sqlexception missing in
package database; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import database.Dbconnect; public class
When trying to connect to mysql I always get this error: java.sql.SQLException: No suitable
I am having this error in my j2ee web application. java.sql.SQLException: ORA-00604: error occurred
I am getting the error: java.sql.SQLException: No suitable driver I have imported the .jar
I have encountered an error, java.sql.SQLException: Column count doesn't match value count at row
I'm doing a simple preparedstatement query execution and its throwing me this error: java.sql.SQLException:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.