sticky
Guidelines when posting JDBC related questions RRS feed

  • General discussion

  • In order to better assist troubleshooting JDBC and JDBC related connectivity issues, the more specific the problem you describe, the faster we can help you out. Please take a few minutes to answer the following questions and post the answers as much as possible along with your specific repro steps. 

    http://blogs.msdn.com/jdbcteam/ or http://blogs.msdn.com/sql_protocols/ may already have your question answered. Check them out.

    [1] Client side:

    1. Which OS platform are you running on? (please specify)
    2. Which JVM are you running on? (please specify)
    3. What is the connection URL in you app? (please specify)
    4. If client fails to connect, what is the client error messages? (please specify)
    5. Is the client remote or local to the SQL server machine? [Remote | Local]
    6. Is your client computer in the same domain as the Server computer? (Same domain | Different domains | WorkGroup)

    [2] Server side:

    1. What is the MS SQL version? [ SQL Server 2000 | SQL Sever 2005]
    2. Does the server start successfully? [YES | NO] If not what is the error messages in the SQL server ERRORLOG?
    3. If SQL Server is a named instance, is the SQL browser enabled? [YES | NO]
    4. What is the account that the SQL Server is running under?[Local System | Network Service | Domain Account]
    5. Do you make firewall exception for your SQL server TCP port if you want connect remotely through TCP provider? [YES | NO | not applicable]
    6. Do you make firewall exception for SQL Browser UDP port 1434? In SQL2000, you still need to make firewall exception for UDP port 1434 in order to support named instance.[YES | NO | not applicable ]

    Tips:

    1. If you are executing a complex statement query or stored procedure, please use execute() instead of executeQuery().
    2. If you are using JDBC transactions, do not mix them with T-SQL transactions.

    Last but not least:

    There is a wealth of information already available to help you answer your questions.

    (1) Online Documentation - http://msdn.microsoft.com/en-us/library/ms378749(v=sql.110).aspx

    (2) MSDN JDBC site: http://msdn.microsoft.com/data/jdbc

    (3) MSN Search: http://www.bing.com or use your favorite search engine.


    Saturday, August 2, 2008 12:44 AM
    Moderator

All replies

  • Hi Jimmy - We recently downloaded JDBC 4.0 driver for testing. Is there a case study on how to configure Windows Integrated Authentication on LINUX(SUSE) server our backend is SQL 2008 R2.

    regards

    Fahad

    Tuesday, April 3, 2012 8:58 PM
  • I'm having a problem with connecting to Sql server from a Java application.

    I'm using Windows 7
    I'm using jdk 7
    And NetBeans as IDE

    I'm using the url below read from the text file: "Successfully"
    com.microsoft.sqlserver.jdbc.SQLServerDriver
    jdbc: sqlserver :/ / 192.168.1.106:1434;
    databaseName = eUniProFaculdade;
    IntegratedSecurity = true

    I'm having the following error message after get some connections

    requesting FACULDADE connection
    returning FACULDADE connection # 0 at count # 13
    requesting FACULDADE connection
    returning FACULDADE connection # 0 at count # 14
    requesting FACULDADE connection
    returning FACULDADE connection # 0 at count # 15
            at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
            at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:241)
            at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2243)
            at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:491)
            at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1309)
            at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
            at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
            at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
            at java.sql.DriverManager.getConnection(DriverManager.java:579)
            at java.sql.DriverManager.getConnection(DriverManager.java:243)
            at mz.ac.eup.cp.ConnectionPool.createConnection(ConnectionPool.java:82)
            at mz.ac.eup.cp.ConnectionPool.getConnection(ConnectionPool.java:63)
            at mz.ac.eup.cp.DataFactory.getConnection(DataFactory.java:73)
            at mz.ac.eup.main.Main$Requestor.run(Main.java:43)

    I'm Using SQLServer 2008

    The database are in other computer but we are connected by the same network

    My firewall is off, and I'm using Windows authentication Mode

    I have tryed enable the tcp configuration alredy, and I still getting the error.

    please someone help me, I'm stuck and my boss is pressing me.

      public ConnectionWrapper getConnection(String databaseId, String databaseUrl, String password, String userName, String drive) throws IOException, SQLException, FileNotFoundException, ClassNotFoundException {
            if (fullCache.size() == MAX_POOL_SIZE) {
                System.out.println(databaseId + " cache is full");
                return null;
            } else {
                //check if there is an using connection
                if (wrapper != null) {
                    //check if there is space for one more request in this wrapper
                    if (wrapper.getLoadCount() == MAX_LOAD_SIZE - 1) {
                        fullCache.offer(wrapper);//add to full and remove from using
                        //create a new wrpper
                        wrapper = new ConnectionWrapper();
                        wrapper.setId(databaseId);
                        wrapper.setConnection(createConnection(databaseId, databaseUrl, password, userName, drive));
                    } else {
                        wrapper.setLoadCount(wrapper.getLoadCount() + 1);
                    }

                } else {
                    wrapper = new ConnectionWrapper();
                    wrapper.setId(databaseId);
                    connection = createConnection(databaseId, databaseUrl, password, userName, drive);
                    wrapper.setConnection(connection);
                }
                return wrapper;
            }
        }

        private Connection createConnection(String databaseId, String databaseUrl, String password, String userName, String drive) throws SQLException, FileNotFoundException, ClassNotFoundException, IOException {

            if (databaseId.toString().toUpperCase().equals(loadConnectionInfo().get(0).toString().toUpperCase())) {
                Class.forName(drive);
                connection = DriverManager.getConnection(databaseUrl, userName, password);
                return connection;

            } else if (databaseId.toString().toUpperCase().equals(loadConnectionInfo().get(5).toString().toUpperCase())) {

                System.setProperty("java.net.preferIPv4Stack" , "true");
                Class.forName(drive);

                connection = DriverManager.getConnection(databaseUrl + userName + password);

                return connection;
            }

            return connection;

    the lines in bold are the ones that show the error message class ConnectionPool.

    I'm trying to make a web application, and so I'm doing coonectionPool, this provides some connections and then give me the error

    Thursday, October 18, 2012 11:56 AM
  • Thanks :) just getting back on board after some well deserved time off.... will give it a go :)

    xo PK79


    PK79 VB C++ HTML PASCALL UNIX LINux Opensource Guru and modest all round lovable gal X

    Thursday, October 18, 2012 3:54 PM