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 8422825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:33:52+00:00 2026-06-10T03:33:52+00:00

I’ve designed a database management system using Java and MySQL. I used WAMP as

  • 0

I’ve designed a database management system using Java and MySQL. I used WAMP as the server. Everything was perfect with that..until now..

Now, I have to go for SQL Express instead of WAMP. I know nothing about SQL Express. I’ve installed it under defaults.

However, now I can connect to the database in Microsoft SQL Server Management Studio with following selections,
(LORDXAX-PC is my computer’s name)

enter image description here

But I need to connect the database with my Java program. (I’ve used JDBC successfully before, with WAMP)

Need help to make this a success?? I’ve tried searching found certain things, but it gives errors. Can someone provide me with clean instructions..

Any help is appreciated. Thanks!


EDIT (2)

This is a complete code demonstrating the issue..

package ExpressTest;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;

public class MAIN {

    public static void main(String[] args) {
        new MAIN().start();
    }

    private void start() {
        System.out.println("START");
        String query = "SELECT * FROM logindata";
        getData(query);
        System.out.println("END");
    }

    public ResultSet getData(String query) {
        Connection CON = null;
        try {
            Class.forName("net.sourceforge.jtds.jdbc.Driver");
            CON = DriverManager.getConnection(URL, USER, PASS);
            RESULT = CON.createStatement().executeQuery(query);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return RESULT;
    }
    private String URL = "jdbc:jtds:sqlserver://localhost/brandix;instance=sqlexpress";
    private String USER = "";
    private String PASS = "";
    private static ResultSet RESULT;
}

This is the complete NetBeans output.

run:
START
java.sql.SQLException: Network error IOException: Connection refused: connect
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:417)
    at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:185)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at ExpressTest.MAIN.getData(MAIN.java:24)
    at ExpressTest.MAIN.start(MAIN.java:16)
    at ExpressTest.MAIN.main(MAIN.java:10)
Caused by: java.net.ConnectException: Connection refused: 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)
END
    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:311)
    at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:261)
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:318)
    ... 7 more
BUILD SUCCESSFUL (total time: 7 seconds)
  • 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-06-10T03:33:54+00:00Added an answer on June 10, 2026 at 3:33 am

    Though many answers are available. I would like to give one.

    As you are using Window Authentication.

    Change JTDS URL from

    private String URL = "jdbc:jtds:sqlserver://localhost/brandix;instance=sqlexpress";
    

    TO

    private String URL = "jdbc:jtds:sqlserver://localhost/brandix;instance=sqlexpress;useNTLMv2=tru‌​e;domain=workgroup";
    

    OR Another alternative is:

    Download the [Microsoft JDBC driver][1]rather than JTDS.
    Add sqljdbc4.jar to your classpath.

    Update your connection string (JDBC URL) for you server

    Use Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver);

    URL : jdbc:sqlserver://localhost;user=root;password=‌​123;"

    If still problem, persist. Check with,

    Enable TCP/IP network protocol, which is disable by default, and set the TCP/IP port to 1433 which is again default port no.

    1. Open the SQL Server Configuration Manager
      Start -> Microsoft SQL Server 2008 -> Configuration Tools -> SQL Server Configuration Manager

    2. Then at the left hand tree. Select SQL Server 2005 Network Configuration-> Protocol for SQLEXPRESS-> TCP/IP.

    3. Right click and enable it.

    4. A window box appear on double click the TCP/IP. Click on the “IP Addresses” Tab

    5. Set the TCP Port value to 1433 then click apply

    6. Restart SQL Service.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into

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.