Exception in connection with MS sql-server2000

i have following code
import java.sql.*;
import java.*;
class Conn2
     public static void main(String args[])throws Exception
          Driver d=(Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
          Connection con=null;
          try
          con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=pubs","sa", "");
          catch(SQLException e)
               e.printStackTrace();     
               System.out.println(e.getMessage());
          if(con!=null)
               System.out.println("connection done");
I have installed driver for sql server2000 from http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&displaylang=en
Exception is
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establis
hing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Sou
rce)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown S
ource)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Conn2.main(Conn2.java:14)
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
wht should i do??

http://forum.java.sun.com/thread.jspa?threadID=419214

Similar Messages

  • Create connection with Oracle SQL Developer

    Hello,
    my test to connect my Oracle database with SQL*PLUS works. Here I need only the username (I test with system), my password and the hostname (orcl).
    Now I want to create this connection with the SQL Developer.
    Here I need the Port. I don't know the port of my database. How can I find it out?

    Hi, the port must be the used by listener, review the $ORACLE_HOME/network/admin/listener.ora file or get the listener status(lsnrctl status) for get the correct port.
    You can try with the default port. (1521).
    Luck.
    Havea good day.
    Regards.

  • I want to Know how to use JDBC connection with postgress sql on Linux

    Hello friends R u Listen to me?
    Pls help me for making JDBC connectivity with postgress Sql On Linux by using Type 4 Driver .
    Is there is any envoirnment setting rqr then pls send me the same on my mail
    My mail is [email protected]
    varsha

    dcminter wrote:
    http://java.sun.com/docs/books/tutorial/jdbc/index.html
    and
    http://www.postgresql.org/docs/
    ;-)

  • PeopleTools 8.49 PeopleSoft Database Cannot Connect with MS SQL Server 2005

    Folks,
    Hello. I am working on PeopleSoft PIA. My system is Windows Server 2003, MS SQL Server Express 2005 Standard, PeopleTools 8.49. I am setting up PeopleSoft Database \PsMpDbInstall\setup.exe and got the errors as follows:
    Error: Setup fails to connect to SQL Server. The default settings SQL Server does not allow remote connection.
    Then I type in "sqlcmd" in Command Prompt and got the same error as follows:
    Name Pipe Provider: Could not open a connection to SQL Server. MS SQL Native Client: the default settings SQL Server does not allow remote connection.
    In order to fix SQL Server 2005 remote connection problem, I have done the 3 steps as follows:
    Step 1: In SQL Server Surface Area Connection, enable local and remote connection, TCP/IP and Name Pipes, SQL Server browser Startup type "automatic" and status "running".
    Step 2: Create exception for SQL Server 2005 and SQL Server browser Service in Windows Firewall.
    Step 3: Add the default SQL Server Port 1433 into Windows Firewall.
    But the above 3 steps cannot resolve SQL Server Express 2005 remote connection problem. Can any folks help to resolve this problem ?
    Thanks.

    Folks,
    Management Studio can connect with SQL Server 2005 successfully.
    I have turned off Windows Server 2003 firewall completely. But "sqlcmd" in Command Prompt still connect with SQL Server 2005 because its remote connection is not allowed.
    Is the "not allow remote connection" problem caused by Windows Firewall or SQL Server 2005 itself ?
    Thanks.

  • Connection with Ms sql server 2005

    Hi
    I will be glad if someone help me.
    I want to make a connection with sql server 2005, I have tried with many drivers but I failed
    This is my simple code
    import java.sql.*;
    public class Test2 {
    public static void  main(String args [])
    try
       Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://MOON-B52CC77905:1433\\MARTIN/emp","usr","pwd");
    catch(ClassNotFoundException cnfe)
    System.err.println(cnfe);
    catch (SQLException sqle)
    System.err.println(sqle);
        }getting two common errors:-
    1/ some Attempts with sqljdbc.jar are generating *[ no suitable Driver ]* error.
    C:\Program Files\Java\jdk1.5.0_22\bin>java -cp sqljdbc.jar;.; Test2
    java.sql.SQLException: No suitable driver2/other attempts with sqljdbc4.jar generates the following error
    C:\Program Files\Java\jdk1.5.0_22\bin>java -cp sqljdbc4.jar;.; Test2
    Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version n
    umber in .class file
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:164)
            at Test2.main(Test2.java:23)

    VANPERSIE wrote:
    ok but
    the problem is that it's required from me to do a project on java 5.
    in addiition to I don't have java6
    please help.
    Edited by: VANPERSIE on Apr 12, 2011 1:14 AMThen don't use sqljdbc4.jar.
    If you had done a simple Google and looked it up on Microsofts site you would have found [URL http://msdn.microsoft.com/en-us/library/ms378422.aspx]this, which explains that it needs 1.6 to run.
    ETA: Also you might have found [URL http://msdn.microsoft.com/en-us/library/ms378526.aspx]this, which explains what the connection string should look like.
    jdbc:sqlserver:<etc etc>
    Edited by: Tolls on 12-Apr-2011 01:08
    Edited by: Tolls on 12-Apr-2011 01:10

  • Oracle Connectivity with MS SQL Server. ORA-00972: identifier is too long

    I have linked Oracle Database with MS SQL Server using HS and DB Link.
    DB Link Script:
    CREATE DATABASE LINK "FCHH"
    CONNECT TO SA
    IDENTIFIED BY <PWD>
    USING 'LISTENER_FCHH';
    Links tested successfully.
    Now "SA" user in Microsoft SQL Server has multiple databases i.e. Master,SecurePerfect,SecurePerfectHistory. when I try following command
    select * from "SecurePerfectHistory.DBO.BadgeHistoryTable"@FCHH
    ORA-00972: identifier is too long

    ORA-00972: identifier is too long
    Cause: An identifier with more than 30 characters was specified.
    Action: Specify at most 30 charactersAman....

  • Connection with ms sql 2005

    Dear all,
    I have two scenario to make connection with sql server 2005.
    1)sqlserver and database 11g both on windows xp 32 bit  .
    Is oracle Gateway best option in such scenario?
    2)Sqlserver on windows xp and 11g database on solaris 64 bit.
    Please provide step by step documents for this.
    Thanks

    Hi,
      You can use an Oracle Database Gateway for both scenarios.
    There are different combinations you can have depending how you want to setup your systems -
    1. sqlserver and database 11g both on windows xp 32 bit
    You can install the gateway either as part of the existing RDBMS install or in a separate ORACLE_HOME.  It is usually better to install the gateway standalone in a separate OH as this makes maintenenace easier.
    2. Sqlserver on windows xp and 11g database on solaris 64 bit.
    You can either -
    a) install the gateway on the Solaris 64-bit machine to connect to the SQL*Server on Wiondows. Again you can install standalone or as part of the existing RDBMS
    b) from the RDBMS on Solaris 64-bit you can access a gateway on the Windows machine. If this is the same Windows machine as in scenario 1 then you can use that gateway which is already installed.
    There are 2 gateways you can use to connect to SQL*Server -
    - Database Gateway for SQL*Server - DG4MSQL
    - Database Gateway for ODBC - DG4ODBC
    There are differences in the licensing and functionality of these 2 gateways which are discussed in these notes -
    Functional Differences Between DG4ODBC and Specific Database Gateways (Doc ID 252364.1)
    Gateway and Generic Connectivity Licensing Considerations (Doc ID 232482.1) 
    The following notes have further details on setting up the gateways -
    How to Setup DG4MSQL (Database Gateway for MS SQL Server) on Windows 32bit post install (Doc ID 466267.1)
    How to Configure DG4MSQL (Oracle Database Gateway for MS SQL Server) 64bit Unix OS (Linux, Solaris, AIX,HP-UX) post install (Doc ID 562509.1)
    How to Setup DG4ODBC (Oracle Database Gateway for ODBC) on Windows 32bit (Doc ID 466225.1)
    How to Configure DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX Itanium) to Connect to Non-Oracle Databases Post Install (Doc ID 561033.1)
    The following note has further details on gateways including links to the documentation -
    Master Note for Oracle Gateway Products (Doc ID 1083703.1)
    These are all available on My Oracle Support.
    Regards,
    Mike

  • Connection with Microsoft SQL Server version 7/2000

    Hello,
    I am a VB expert, but new in Oracle forms by starting from 6i.
    I am trying to get connected from oracle forms to Microsoft SQL server to get some data as batch job.
    Is some body can help me connecting to MS SQL Server, please.

    Hi,
    Create the odbc data source of SQL Server database and then while connecting through the Forms in the connection string write UserName/Password and host string as odbc:<odbc_Name>.
    Hope this will work.
    Regards
    gaurav

  • SQL exception when try to connect with MS SQL server

    Hello Sir,
    When i run the jsp file which connect to to MS Sql server database and fetch the data.
    Its throwing the SQLException error like:
    Name java: is not bound in this Context
    here is my server.xml
    [code<?xml version='1.0' encoding='utf-8'?>
    <Server>
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
      <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
        <Resource name="testDB" type="javax.sql.DataSource"/>
         <ResourceParams name="UserDatabase">
          <parameter>
            <name>factory</name>
            <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
          </parameter>
          <parameter>
            <name>pathname</name>
            <value>conf/tomcat-users.xml</value>
          </parameter>
        </ResourceParams>
         <ResourceParams name="testDB">
          <parameter>
            <name>maxWait</name>
            <value>5000</value>
          </parameter>
          <parameter>
            <name>maxActive</name>
            <value>10</value>
          </parameter>
          <parameter>
            <name>password</name>
            <value>testpass</value>
          </parameter>
          <parameter>
            <name>url</name>
            <value>jdbc:microsoft:sqlserver://localhost:1433;DataBaseName=test;</value>
          </parameter>
          <parameter>
            <name>driverClassName</name>
            <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
          </parameter>
          <parameter>
            <name>maxIdle</name>
            <value>2</value>
          </parameter>
          <parameter>
            <name>username</name>
            <value>testuser</value>
          </parameter>
        </ResourceParams>
      </GlobalNamingResources>
      <Service name="Catalina">
        <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
        </Connector>
        <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
        </Connector>
        <Engine defaultHost="localhost" name="Catalina">
          <DefaultContext className="org.apache.catalina.core.StandardDefaultContext">
            <ResourceLink global="testDB" name="testDB" type="javax.sql.DataSource"/>
              </DefaultContext>
          <Host appBase="webapps" name="localhost">
            <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
          </Host>
          <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
        </Engine>
      </Service>
    </Server>
    [/code]

    Hello Sir,
    I tried my level best, I couldn't solve the error. Still iam getting the same error Name java:comp is not bound in this Context
    Again for your reference i am adding server.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Server>
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
      <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
        <Resource name="jdbc/datasourceDB" auth="Container" type="javax.sql.DataSource"/>
         <ResourceParams name="UserDatabase">
          <parameter>
            <name>factory</name>
            <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
          </parameter>
          <parameter>
            <name>pathname</name>
            <value>conf/tomcat-users.xml</value>
          </parameter>
        </ResourceParams>
         <ResourceParams name="jdbc/datasourceDB">
          <parameter>
            <name>maxWait</name>
            <value>5000</value>
          </parameter>
          <parameter>
            <name>maxActive</name>
            <value>10</value>
          </parameter>
          <parameter>
            <name>password</name>
            <value>mani</value>
          </parameter>
          <parameter>
            <name>url</name>
            <value>jdbc:microsoft:sqlserver://<servername>:1433;DataBaseName=trax;selectMethod=cursor</value>
          </parameter>
          <parameter>
            <name>driverClassName</name>
            <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
          </parameter>
          <parameter>
              <name>driverName</name>
              <value>jdbc:jtds:sqlserver://<servername>:1433;DatabaseName=trax</value>
          </parameter>
          <parameter>
            <name>maxIdle</name>
            <value>2</value>
          </parameter>
          <parameter>
            <name>username</name>
            <value>mani</value>
          </parameter>
        </ResourceParams>
      </GlobalNamingResources>
      <Service name="Catalina">
        <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
        </Connector>
        <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
        </Connector>
        <Engine defaultHost="localhost" name="Catalina">
          <DefaultContext className="org.apache.catalina.core.StandardDefaultContext">
            <ResourceLink global="datasourceDB" name="datasourceDB" type="javax.sql.DataSource"/>
              </DefaultContext>
          <Host appBase="webapps" name="localhost">
            <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
          </Host>
          <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
        </Engine>
      </Service>
    </Server>part of web.xml added
         <resource-ref>
         <description> JDBC Driver:com.microsoft.jdbc.sqlserver.SQLServerDriver</description>
         <res-ref-name>jdbc/datasourceDB</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
         </resource-ref>my java code:
                   Context initCtx = new InitialContext();
                   Context envCtx = (Context) initCtx.lookup("java:comp/env");
                   DataSource ds = (DataSource) envCtx.lookup("jdbc/datasourceDB");
                   conn = ds.getConnection();Plz provide me the help.. i am suffering from this error since 1 week.
    Regards
    venki.

  • Connection with MS SQL Server 2000

    Our Application server is in UNIX and we need to select data from a MS SQL Server 2000 table and this non SAP server is in Windows OS. Is it possible to establish a connection from  our application server which is in UNIX to Non SAP server MS SQL Server 2000 which OS is Windows ? Again, how to call a MS SQL stored procedure from Oracle ?
    Please help me.

    Hi there;
    I am a starter with Java and need your help with this little program.
    Create a console application project named Payroll that stores an employee's hourly pay rate and hours worked. Compute gross pay (hours times rate), withholding tax, and net pay (gross pay minus withholding tax). Withholding tax is computed as a percentage of gross pay based on the following:
    Gross Pay: Withholding percentage :
    0 to 300.00 ::::: :::::: Withholding percentage 10%
    300.00 to 400.00:::::: Withholding percentage 12 %
    400.01 to 500.00 :::::: Withholding percentage 15 %
    500.01 and over ::::::: Withholding percentage 2 0 %
    Thank you
    Alex

  • Connection with MS -SQL server Database

    Hi Experts,
    We are new with Oracle SES.
    We have created one table in MS SQL server 2005 in testing database called as Northwind, table is EMPdate with adding required column name as "URL","KEY","CONTENT","LASTMODIFIEDDATE","LANG".
    Now we create database source in Oracle SES by giving following things
    Database Connecting String: jdbc:sqlserver//<Loaclhost>:1433;databasename=Northwind
    UserId:
    Password:
    Query: Select URL,KEY,CONTENT,LASTMODIFIEDDATE,LANG,'text/html' CONTENTTYPE from EMPdate
    path separator: #
    Document Count : -1
    Parse Attributes :false
    And create Source & when we run schedule on this datadase source we got error that "invalid SQL command"
    Please can you provide sequence of steps to create MS SQL Server database source & generate the statistics.
    Thanks

    Hi,
    Thanks for the response.
    Running the Schedule for Stats collection -- I mean,the Schedule step whcih could be the immediate step just after database source creation
    The Crawl of the SQL Server not succeeded is Crawl Error
    which is located in C:\oracle\product\10.1.8\oradata\ses2\log direcory.
    We succeded with Web,ORACLE TABLE and FILE system sources as they were documented in the manual.
    Please Suggest all the steps to configure SQL server as Source
    Thanks in Advanace
    Cheers,
    Ramesh

  • Null Pointer Exception when working with Custom Sql

    I viewed the video on adding Custom Sql and everything seemed to work fine with regards to adding it to my report. However, I get a null pointer exception when I add a field from the Custom Sql table to the report and try to run the report including if I try to View Sql. There doesn't seem to be a stacktrace that I can show.
    BTW... this was a work around for not being able to use Stored Procedures... I have killed 2 days now working on different ways to work around the Stored Procedure thing
    Thanks,
    Steve

    Hi,
    I'm trying to use a custom sql in my report. I could successfully create a custom SQL and add it to my report in the designer. But I'm getting NullPointer exception when I try to see the results in Preview. Can someone please help me resolve this issue.
    Thanks!

  • Oracle DB on Redhat 5 connectivity with MS sql Server

    Dear All,
    Env.
    Oracle EBS R12 – DB 10gR2 with RAC on Redhat linux 5
    We want to connect OracleDB10gR2 to MS sql Server 2000/2005 on Windows 2003.
    What is the way or which utility(ODBC) can be used to do this, anybody help us with detail??
    Regards

    HSODBC is what you'll want to do that, but you'll need a SQL Server ODBC driver that runs on Linux, and you'll have to get that from a 3rd party unless MS provides one.
    Assuming you have Metalink access, the following note should help:
    Note.264567.1 Ext/Pub How To Setup Generic Connectivity - HSODBC - on Linux:
    Hope it helps,
    Greg

  • DB connect with MS SQL

    Hi,
    We are in BW 3.5 with DB as Oracle and OS AIX.
    Is it possible to extract data form the the MS SQL server by using DB connect
    Heard that to extract data from MS SQL,the OS of the BW system should be windows NT
    Please guide me 
    Thanks
    Sarasu

    Hi Sarasu,
    you can certainly use DB MultiConnect to do this.
    The issue you may face is that the SAP Kernel must support the non-SAP database. If you are not running your SAP application server on a Windows platform then the SAP Kernel you are running will not support MS-SQL. This makes sense as MS-SQL will only run on Windows so why bother putting MS-SQL support into a non-windows kernel.
    So if you have your BW system running on a non-windows application server then you will need to find another way to achieve this. You could add a windows application server to your BW system landscape for this purpose. SAP fully supports heterogeneous system landscapes i.e. different types of application servers mixed into a single SAP system.
    Cheers
    Graham Robbo

  • Non-Deterministic Exception When Connecting With Wrong Client Certificate

    I am working on an internal application and need to determine the correct client-side SSL certificate to use when connecting to a server (the user can supply multiple client-side certificates). I had expected that if I connected to a server using the wrong client certificate the java client would throw a SSLHandshakeException and I could then try the next certificate. This seems to work some of the time, however the java client will sometimes throw a “SocketException: Software caused connection abort: recv failed”, in which case it is not possible to know that the wrong certificate caused the problem.
    Below is the code I have been using to test as well as the intermittent SocketException stack trace. Does anyone have an idea as to how to fix this problem? Thanks in advance.
    Note: the TrustAllX509TrustManager is a trust manager that trusts all servers.
    protected void connectSsl() throws Exception {
          final String host = "x.x.x.x";
          final int portNumber = 443;
          final int socketTimeout = 10*1000;
          // Note: Wrong certificate (expect SSLHandshakeException).
          final String certFilename = "C:\\xxx\\clientSSL.P12";
          final String certPassword = "certPassword";
          final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File(certFilename)));
          final char[] certificatePasswordArray = certPassword.toCharArray();
          final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
          final KeyStore keyStore = KeyStore.getInstance("PKCS12");
          keyStore.load(bis, certificatePasswordArray);
          keyManagerFactory.init(keyStore, certificatePasswordArray);
          final KeyManager[] keyManagers = keyManagerFactory.getKeyManagers();
          final SSLContext context = SSLContext.getInstance("SSL");
          context.init(keyManagers, new TrustManager[]{new TrustAllX509TrustManager()}, new SecureRandom());
          final SocketFactory secureFactory = context.getSocketFactory();
          final Socket socket = secureFactory.createSocket();
          final InetAddress ip = InetAddress.getByName(host);
          socket.connect(new InetSocketAddress(ip, portNumber), socketTimeout);
          socket.setSoTimeout(socketTimeout);
          // Write the request.
          final OutputStream out = new BufferedOutputStream(socket.getOutputStream());
          out.write("GET / HTTP/1.1\r\n".getBytes());
          out.write("\r\n".getBytes());
          out.flush();
          InputStream inputStream = socket.getInputStream();
          ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
          byte[] byteArray = new byte[1024];
          int bytesRead = 0;
          while ((bytesRead = inputStream.read(byteArray)) != -1) {
             outputStream.write(byteArray, 0, bytesRead);
          socket.close();
          System.out.println("Response:\r\n" + outputStream.toString("UTF-8"));
       }Unexpected SocketException:
    main: java.net.SocketException: Software caused connection abort: recv failed
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
         at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1435)
         at com.sun.net.ssl.internal.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:103)
         at com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:612)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:808)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:734)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:197)
         at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
         at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
         at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
         at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)

    Thanks for the quick response. Here are answers to the questions:
    1) No, this issue is not associated with one particular certificate. I have tried several certificates and see the same issue.
    2) I agree it would be simpler to only send the required certificate, but unfortunately the project requires that the user be able to specify multiple certificates and, if a client-side certificate is required, the application try each one in turn until the correct certificate is found.
    3) Yes, I realize the TrustAllX509TrustManager is insecure, but I am using this for testing purposes while trying to diagnose the client certificate problem.
    In terms of testing, I am just wrapping the above code in a try/catch block and executing it in a loop. It is quite odd that the same exact code will sometimes generate a SSLHandshakeException and other times a SocketException.
    One additional piece of information: if I force the client code to use "SSLv3" using the Socket.setEnabledProtocols(...) method, the problem goes away (I consistently get a SSLHandshakeException). However, I don't think this solves my problem as forcing the application to use SSLv3 would mean it could not handle TLS connections.
    The code to specify the SSLv3 protocol is:
    SSLSocket sslSocket = (SSLSocket) socket;
    sslSocket.setEnabledProtocols(new String[] {"SSLv3"});
    One other strange issue: if instead of specifying the SSLv3 protocol using setEnabledProtocols(...) I instead specify the protocol when creating the SSLContext, the SocketException problem comes back. So if I replace:
    final SSLContext context = SSLContext.getInstance("SSL");
    with:
    final SSLContext context = SSLContext.getInstance("SSLv3");
    and remove the "sslSocket.setEnabledProtocols(new String[] {"SSLv3"})" line, I see the intermittent SocketException problem.
    All very weird. Any thoughts?

Maybe you are looking for

  • Additional field in material document list

    Dear Expert, In the T.code MB51 ( material document list)  in the ITEM DATA i need to add origin group field , is it possible ? kindly help the above issue,, Regards Akshaya

  • Post stop condition duration

    Hi I one to collect 5 seconds of data prior to the start of a test, and then 30 seconds after the end.  So I have been using start and stop condition with pre and post logging options.  For the start condition, with 5 seconds pre condition every thin

  • [iPhone] Location-aware web app

    I've been tapped to create a web app formatted for use on an iPhone that will display results depending on the user's current location. Since this is a web app, not an internal one, is there a way I can get a user's location sent to a web app (query

  • Repair my HD using disk utility, please help!

    hi, i performed a "verify disk" in disk utility on my "MACINTOSH HD" and apparently "1 HFS volume needs to be repaired" however, the "repair disk" button is greyed out, how can i fix this HFS volume???? also if someone could tell me what a HFS volume

  • What is the best way to deal with iTunes libraries that have more than 25,000 songs and iTunes match?

    Hello, My library approaches the 25,000 songs limit from iTunes match mainly because I have a lot of custom mixes with loads of different tracks. On those songs there are some that I would like iTunes match to ignore. But I still want to keep them in