Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JDBC Oracle thin , connection refused !

2 views
Skip to first unread message

gilles tost

unread,
Mar 23, 1998, 3:00:00 AM3/23/98
to

Hi,

I have a problem with JDBC / ORACLE

I write :

DriverManager.getconnection("jdbc:oracle:thin:@152.9.102.137:1521:dbname","login","password")

But i don't know what is exactly "dbname" ?

And i get the following error:

The error message we are getting are:
java.sql.SQLException: Connection refused
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:223)
at oralce.jdbc.driver.OracleConnection.(init)(OracleConnection.java:100)
at
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:146)
at java.sql.DriverManager.getConnection(DriverManager.java:91)
at java.sql.DriverManager.getConnection(DriverManager.java:134)
at sqltest.main(sqltest.java:10)

Could you explain me what mean "host:port:dbname" ... ?

It will be very cool, it is for a traning periode .

Thank you very much.

Best Regards.

Gilles TOST, (Studient).

Tom Randulff

unread,
Mar 23, 1998, 3:00:00 AM3/23/98
to

On Mon, 23 Mar 1998 15:57:56 +0100, gilles tost
<gt...@etud.insa-tlse.fr> wrote:

>I have a problem with JDBC / ORACLE
>
>I write :
>
>DriverManager.getconnection("jdbc:oracle:thin:@152.9.102.137:1521:dbname","login","password")
>
>But i don't know what is exactly "dbname" ?
>
>And i get the following error:
>
>The error message we are getting are:
> java.sql.SQLException: Connection refused
> at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:223)
>at oralce.jdbc.driver.OracleConnection.(init)(OracleConnection.java:100)
> at
>oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:146)
> at java.sql.DriverManager.getConnection(DriverManager.java:91)
> at java.sql.DriverManager.getConnection(DriverManager.java:134)
> at sqltest.main(sqltest.java:10)

if you catch the SQLException you can get the error code and error
message returned by Oracle, which will make it easier to debug.

try {
// whatever
} catch (SQLException e) {
System.err.println("Error code: " + e.getErrorCode());
System.err.println("Error message: " + e.getErrorMessage());
}

You can then look up the error in 'Oracle Server Messages' or use the
oerr utility.

>Could you explain me what mean "host:port:dbname" ... ?

host = host address (ip number) or host name
port = TCP/IP port number of TNSLISTENER service on the host you're
connecting to.
dbname = SID (Oracle Server ID)

Look in $ORACLE_HOME/network/admin/tnsnames.ora (or find tnsnames.ora
on your system) and look for a line with (SID = 'your SID here').
Usually the SID is 'orcl' by default.

>It will be very cool, it is for a traning periode .

I can recommend 'Understanding SQL*NET'.

Tom


Wray Smallwood

unread,
Mar 26, 1998, 3:00:00 AM3/26/98
to

Connection refused means no one is listening at that port (1521) Do you
have SQL*Net V2 set up properly as a TNS Listener. Try telnet'ing to
the port. (telnet machine_name 1521) If you get the same connection
refused message, it's a confirmation. If it connects but times out,
that's an indication that something is listening, and the problem is
probably in SQl*Net config.
0 new messages