Re: Help me please.

From: Davis Swan <davis_swan_at_compuserve.com>
Date: 20 Nov 2001 11:19:37 -0800
Message-ID: <9c22e06f.0111201119.6ed4f16f_at_posting.google.com>


ftp <shyan_at_cse.cuhk.edu.hk> wrote in message news:<9r6pvr$7d2$1_at_eng-ser1.erg.cuhk.edu.hk>...
> I copy the folloiwng program from oracle hompage
> http://technet.oracle.com/doc/java.815/a64685/getsta3.htm#1001200
>
> import java.sql.*;
> import oracle.jdbc.driver.*;
>
> class JDBCVersion
> {
> public static void main (String args [])
> throws SQLException
> {
> // Load the Oracle JDBC driver
> DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
> Connection conn =
> DriverManager.getConnection("jdbc:oracle:thin:_at_:1588localhost:sid","username","password");
>
> // Create Oracle DatabaseMetaData object
> DatabaseMetaData meta = conn.getMetaData ();
>
> // gets driver info:
> System.out.println("JDBC driver version is " + meta.getDriverVersion());
> }
> }
>
> sid is the sid of my database. username and password is the login username
> and password.
> I haven't changed the port nubmer. Is it true that the default port is
> 1588?
>
> When I run the program, the following error occur:
> java.sql.SQLException: Io exception: The Network Adapter could not
> establish the connection
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
> at
> oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java)
> at
> oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java)
> at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
> at java.sql.DriverManager.getConnection(Compiled Code)
> at java.sql.DriverManager.getConnection(DriverManager.java:126)
> at JDBCVersion.main(JDBCVersion.java:11)
>
> How can I solve the problem?
>
> --

Looks to me like you have an extra colon. The URL should be jdbc:oracle:thin:_at_1588localhost:sid Received on Tue Nov 20 2001 - 20:19:37 CET

Original text of this message