facebook

DataBase Connectivity

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #293114 Reply

    This message has not been recovered.

    #293138 Reply

    ernestz
    Member

    This message has not been recovered.

    #293140 Reply

    This message has not been recovered.

    #293154 Reply

    ernestz
    Member

    This message has not been recovered.

    #293170 Reply

    This message has not been recovered.

    #293173 Reply

    ernestz
    Member

    The connection URL should be of the format “jdbc:microsoft:sqlserver://localhost:1433”, which you originally posted, not “jdbc:microsoft:home://localhost:1433”. Change it back.

    #293217 Reply

    when i change it following error occur
    cod
    import java.sql.*;
    public class Test {

    /**

    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    System.out.println(“Test I”);
    try
    {
    Class.forName(“com.microsoft.jdbc.sqlserver.SQLServerDriver”);
    System.out.println(“Test ->Driver Loaded”);
    Connection con=DriverManager.getConnection(“jdbc:microsoft:sqlserver://localhost:1433;User=sa;Password=bipinbihari”);
    System.out.println(“Test ->Connection Established”);
    Statement smt=con.createStatement();
    ResultSet rs=smt.executeQuery(“select * from test”);
    while(rs.next())
    {
    System.out.print(rs.getString(1));
    }
    rs.close();
    smt.close();
    con.close();
    }catch(Exception e){e.printStackTrace();}
    }

    }

    output
    Test I
    Test ->Driver Loaded
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing 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 Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at Test.main(Test.java:14)

    #293231 Reply

    ernestz
    Member
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. 

    indicates your application cannot establish a connection to your SQL Server located at localhost, port 1433.

    Pretty basic trouble shooting, make sure your SQL Server is up and listening on that port, verify SQL server is configured for TCP/IP connections, not just Named Pipes, etc.

    #293239 Reply

    yes tcp/ip is enabled and running on port 1433
    my computer name is home when i make dsn it works.but did not work with type 4
    when i put home in place of sql server diferent out put apears please help me where is mistake i tried all the driver sqlsever 2000 ,sp2, sp3. but non work
    and output is
    Test I
    Test ->Driver Loaded
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager.java:532)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at Test.main(Test.java:14

    #293244 Reply

    ernestz
    Member

    That’s because the MS JDBC Drivers require the URL prefix of “jdbc:microsoft:sqlserver://{hostname}:{port}”. You cannot replace “sqlserver” with any string of your choosing, otherwise, you will get this “no suitable driver”.

    #293681 Reply

    schanamolu
    Member

    Kalla,

    I’m still getting the following error message. ” Connections could not be acquired from the underlying database!”

    The detail exception is as follow

    when we try to get database connections we got the following exceptions

    “Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!”

    ApplicationContext.xml

    <property name=”jdbcUrl”>
    <value>
    jdbc:oracle:oci:@${jdbc.host}:${jdbc.port}:${jdbc.database}
    </value>
    </property>

    startup.bat

    We modified startup.bat in tomcat/bin directory


    @echo
    off
    if “%OS%” == “Windows_NT” setlocal
    rem —————————————————————————
    rem Start script for the CATALINA Server
    rem
    rem $Id: startup.bat 302918 2004-05-27 18:25:11Z yoavs $
    rem —————————————————————————

    set CATALINA_OPTS=-Djava.library.path=E:\oracle\ora92\bin

    rem Guess CATALINA_HOME if not defined
    set CURRENT_DIR=%cd%
    if not “%CATALINA_HOME%” == “” goto gotHome
    set CATALINA_HOME=%CURRENT_DIR%

    ………………………

    Enviornemnt Variable changes:

    we referenced ocijdbc9.dll library by setting path enviornment variable ORALCE_HOME/bin

    We copied ojbdc14.jar to this directory C:\tomcat\shared\lib

    Any Help would be appreciated

    Thanks,
    Sreedhar

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: DataBase Connectivity

You must be logged in to post in the forum log in