0

I am trying connect to Microsoft SQL server from java code which is in dynamic project which is going to run in the Webspehere 7 server.

below is my  java code:
{
Connection conn = null;
        System.out.println(System.getProperty("java.version"));
        System.out.println(ManagementFactory.getRuntimeMXBean().getVmVersion());


            try {
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
            String dbURL = "jdbc:sqlserver://IP:51433;database=SCB_Recon_04032017";
            String user = "uName";
            String pass = "password";
            conn = DriverManager.getConnection(dbURL, user, pass);
}

NOTE: when I run this as java application(run java class independently) connection established correctly. But when I run this on webspehere 7 server I am getting below exception.

{[21/6/17 16:41:07:170 IST] 0000001c SystemErr     R com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed.".
[21/6/17 16:41:07:171 IST] 0000001c SystemErr     R     at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368)
[21/6/17 16:41:07:171 IST] 0000001c SystemErr     R     at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1412)
[21/6/17 16:41:07:171 IST] 0000001c SystemErr     R     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1058)
[21/6/17 16:41:07:172 IST] 0000001c SystemErr     R     at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
[21/6/17 16:41:07:172 IST] 0000001c SystemErr     R     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
[21/6/17 16:41:07:172 IST] 0000001c SystemErr     R     at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
[21/6/17 16:41:07:173 IST] 0000001c SystemErr     R     at java.sql.DriverManager.getConnection(DriverManager.java:419)
[21/6/17 16:41:07:173 IST] 0000001c SystemErr     R     at java.sql.DriverManager.getConnection(DriverManager.java:467)
[21/6/17 16:41:07:173 IST] 0000001c SystemErr     R     at com.eeft.scbfileupload.sql.connection.JdbcSQLServerConnection.getConnection(JdbcSQLServerConnection.java:31)
[21/6/17 16:41:07:174 IST] 0000001c SystemErr     R     at com.eeft.scbfileupload.api.ScbFileUploadAPIBase.getAllTemplateTypesList(ScbFileUploadAPIBase.java:23)
[21/6/17 16:41:07:175 IST] 0000001c SystemErr     R     at com.eeft.scbfileupload.bo.ScbFileUploadBO.getAllTemplateTypesList(ScbFileUploadBO.java:20)
[21/6/17 16:41:07:184 IST] 0000001c SystemErr     R     at com.eeft.scbfileupload.servlet.SCBFileUploadMainServlet.doGet(SCBFileUploadMainServlet.java:35)
[21/6/17 16:41:07:184 IST] 0000001c SystemErr     R     at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
[21/6/17 16:41:07:186 IST] 0000001c SystemErr     R     at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[21/6/17 16:41:07:186 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1700)
[21/6/17 16:41:07:187 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:970)
[21/6/17 16:41:07:187 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:508)
[21/6/17 16:41:07:189 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181)
[21/6/17 16:41:07:189 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3994)
[21/6/17 16:41:07:189 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
[21/6/17 16:41:07:190 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:945)
[21/6/17 16:41:07:191 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
[21/6/17 16:41:07:191 IST] 0000001c SystemErr     R     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191)
[21/6/17 16:41:07:191 IST] 0000001c SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
[21/6/17 16:41:07:191 IST] 0000001c SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:516)
[21/6/17 16:41:07:192 IST] 0000001c SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:307)
[21/6/17 16:41:07:198 IST] 0000001c SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:278)
[21/6/17 16:41:07:199 IST] 0000001c SystemErr     R     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[21/6/17 16:41:07:201 IST] 0000001c SystemErr     R     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[21/6/17 16:41:07:201 IST] 0000001c SystemErr     R     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
[21/6/17 16:41:07:202 IST] 0000001c SystemErr     R     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[21/6/17 16:41:07:202 IST] 0000001c SystemErr     R     at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[21/6/17 16:41:07:202 IST] 0000001c SystemErr     R     at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[21/6/17 16:41:07:202 IST] 0000001c SystemErr     R     at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[21/6/17 16:41:07:203 IST] 0000001c SystemErr     R     at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[21/6/17 16:41:07:203 IST] 0000001c SystemErr     R     at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[21/6/17 16:41:07:203 IST] 0000001c SystemErr     R     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1662)
    }
1
  • One should not connect to database from within the application server like this. Facilities provided by the server should be used (datasources, JNDI). Read something about database connectiviy in Java EE. Commented Jun 24, 2017 at 7:58

1 Answer 1

1

SSLv3 is enabled by default in IBM WebSphere Application Server. These fixes will disable SSLv3 completely.

Also if you don't want to disable SSLv3 support on WebSphere you can download the Microsoft SQLJDBC driver hotfix to correct work with SSL. And you need to configure MSSQL to enable SSL in this case.

See here for additional information.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you mike for for your quick answer.Seems like this is what I am looking for. will check and update.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.