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

  • SEARCH
  • Home
  • 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 7130057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:18:34+00:00 2026-05-28T11:18:34+00:00

I’m trying to write a really simple GUI app for inserting some records into

  • 0

I’m trying to write a really simple GUI app for inserting some records
into a database, and reading back some records (nothing fancy, just 1 table with 3 rows, no relations).
The source…

package EntryProg;
import java.sql.*;
import com.microsoft.sqlserver.jdbc.*;



public class CourseDataEntryHandler
{
    private Connection connect;
    private CallableStatement callState;
    private ResultSet rSet;
    private SQLServerDataSource dSource;

    public CourseDataEntryHandler()
    {
        rSet = null;
        callState = null;

        dSource = new SQLServerDataSource();
        dSource.setUser(REDACTED);
        dSource.setPassword(REDACTED);
        dSource.setServerName(REDACTED);
        dSource.setPortNumber(REDACTED);
        dSource.setDatabaseName(REDACTED);
        dSource.setEncrypt(true);
        dSource.setTrustServerCertificate(true);
        try
        {

Error here

            connect = dSource.getConnection();

end error

        }
        catch (SQLServerException e)
        {
            //TODO Figure out how to handle -- logging for now, console
            do
            {
                System.out.println(e.getErrorCode());
                System.out.println(e.getMessage());
                System.out.println(e.getSQLState());
                e = (SQLServerException) e.getNextException();
            } while (e != null);
            System.out.println("END");
            System.out.println();
        }
    }

I get the following error…

(code)0

(message)SQL Server did not return a response. The connection has been closed.

(state)08S01

I’ve verified that the user,pass,server name,port, and DB name are all accurate.
If I change the username to a non-valid one, I get a “could not log in” error reported back so I know I’m hitting the server.

I’ve not been able to fully connect once, so I know it’s not a “too many connections” issue, as the only person currently logged into the server is me via sql management studio. It doesn’t work when I log out of that either so definitely not a connections # issue.

The applications user has datareader/datawriter permissions as well.
(I’m using Eclipse, if that matters. And am referencing the sqljdbc4.jar library).

I’m at a loss as to where to go with troubleshooting this. Any help would be greatly appreciated.

EDIT
Update – I’ve also tried a connection string and using DriverManager.getConnection(connString) to set the connection, that didn’t work either. The result is the same.
Also, SQL server 2008 r2 is the sql server version I’m using.

EDIT
I wrote a quick C# program to test the connection, sure enough the connection works fine in .net, unfortunately I have to use java for this project (it’s a project I’ve chosen to do on my own for a class, only requirement is it be in Java…teacher has no clue what’s going on either).

  • 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-28T11:18:34+00:00Added an answer on May 28, 2026 at 11:18 am

    Comment the line with setEncrypt(true):

    ...
    dSource.setDatabaseName(REDACTED);
    //dSource.setEncrypt(true);
    dSource.setTrustServerCertificate(true);
    ...
    

    You might have trouble with the encryption setting. From the setEncrypt(…) documentation:

    If the encrypt property is set to true, the Microsoft SQL Server JDBC Driver uses the JVM’s default JSSE security provider to negotiate SSL encryption with SQL Server. The default security provider may not support all of the features required to negotiate SSL encryption successfully. For example, the default security provider may not support the size of the RSA public key used in the SQL Server SSL certificate. In this case, the default security provider might raise an error that will cause the JDBC driver to terminate the connection. In order to resolve this issue, do one of the following:

    • Configure the SQL Server with a server certificate that has a smaller RSA public key

    • Configure the JVM to use a different JSSE security provider in the “/lib/security/java.security” security properties file

    • Use a different JVM

    Update

    With Java versions 1.6.0_29 and 7.0.0_1 Oracle introduced a security fix for the SSL/TLS BEAST attack that very likely will cause the very same problem. The above security fix is known to make trouble for database connections to MSSQL Server with both the jTDS driver and the Microsoft driver. You can either

    • decide not to use encryption by not using setEncrypt(true) (as specified above)
    • or, if it is enforced by MSSQL Server, you could turn off the Java fix in your JVM by setting the -Djsse.enableCBCProtection=false system property. Be warned, it will affect all SSL connections within the same VM.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am currently running into a problem where an element is coming back from
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.