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

Java Connection to Oracle 8 personal edition

1 view
Skip to first unread message

Florinda Oliveira

unread,
Feb 17, 2001, 10:19:48 AM2/17/01
to
Hallo guys,

I am new to Java and have been trying to connect to Oracle database but
unsuccessfully. I can connect to MS Access easily using
sun.jdbc.odbc.JdbcOdbcDriver.

I tried a number of times to connect to oracle using
oracle.jdbc.driver.OracleDriver. But I keep getting the error message of
class not found.

The other problem is that, I don't know how to formulate the url for oracle
personal default database. The user id is scott and password is tiger. I
have created a DSN called employee.

I have learnt that connecting to oracle from java is a problem. Can anybody
help please?

Many thanks,

Richard...@btinternet.com


Simon Brooke

unread,
Feb 17, 2001, 2:59:16 PM2/17/01
to
on Saturday 17 February 2001 15:19, Florinda Oliveira wrote:

> Hallo guys,
>
> I am new to Java and have been trying to connect to Oracle database
> but
> unsuccessfully. I can connect to MS Access easily using
> sun.jdbc.odbc.JdbcOdbcDriver.
>
> I tried a number of times to connect to oracle using
> oracle.jdbc.driver.OracleDriver. But I keep getting the error message
> of class not found.

In that case it isn't in your classpath. It's packaged in a file called
classes111.zip or classes12.zip (there may be other variants but those
are the ones I've seen). Find it, and ensure that it is in your
CLASSPATH

>
> The other problem is that, I don't know how to formulate the url for
> oracle
> personal default database. The user id is scott and password is
> tiger. I have created a DSN called employee.

The following format *does* work:

jdbc:oracle:thin:@gododdin.internal.jasmine.org.uk:1521:lnmgr2

where

jdbc:oracle:thin

is the protocol and subprotocol part and you shouldn't change it;

gododdin.internal.jasmine.org.uk

is the name of the host serving the database, and you should change it
to whatever your host's fully qualified DNS name is

1521

is the default Oracle listener port, and you probably shouldn't change
it

lnmgr2

is the name of the Oracle instance you want to connect to.

However, in theory it really should be

protocol://username:pass...@host.domain.name:portnumber/instancename

I haven't actually tried this...

>
> I have learnt that connecting to oracle from java is a problem. Can
> anybody help please?

<URL:http://java.sun.com/j2se/1.3/docs/api/java/sql/DriverManager.html#getConnection(java.lang.String,
java.lang.String, java.lang.String)>

--
si...@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/

;; I'd rather live in sybar-space

Florinda Oliveira

unread,
Feb 19, 2001, 2:51:39 PM2/19/01
to
Simon,

I have already done what you are suggesting. This is what I did:
"jdbc:oracle:thin:@EXTPROC_CONNECTION_DATA:1521:PLSExtProc"

This does not work. In fact, it asks to go online. When the database I am
connecting is local, it should do this. It should connect straight away. In
the string above:

* EXTPROC_CONNECTION_DATA is the name of the default database. When
connecting to SQL Plus, this connect string is left blank.

* PLSExtProc is the SID.

This is the error I get when I cancel the connection to the internet:
----------------------
java.sql.SQLException: Io exception: The Network Adapter could not establish
the
connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
at
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:263)

at
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at
ConnectToOracleDatabase.blnGetConnection(ConnectToOracleDatabase.java
:74)
at ConnectToOracleDatabase.main(ConnectToOracleDatabase.java:37)
Connection is not open
Press any key to continue . . .
---------------------------------------------

When I accept to connect to the internet, I still get the same error.

When I use a different protocol, e.g. oci, I get a different error:
----------
Exception in thread "main" java.lang.UnsatisfiedLinkError: make_c_state
at oracle.jdbc.oci8.OCIDBAccess.make_c_state(Native Method)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:233)
at
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:249)

at
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at
ConnectToOracleDatabase.blnGetConnection(ConnectToOracleDatabase.java
:73)
at ConnectToOracleDatabase.main(ConnectToOracleDatabase.java:36)
Press any key to continue . . .

----------

Below is the way I am doing this:
"jdbc:oracle:oci8:@employee" where employee is the name of my DSN as created
in Control Panel ODBC32 data.

Whatever I do, I get an error. This is doable, as I have already connected
to oracle 8 personal edition before via sql plus, asp and visual basic.

Please send any comments that can be useful.

Many thanks,

Richard...@btinternet.com


"Simon Brooke" <si...@jasmine.org.uk> wrote in message
news:oKAj6.13$FO4...@newreader.ukcore.bt.net...

Bobas42

unread,
Feb 21, 2001, 3:31:23 PM2/21/01
to
Hi there,
I am also facing the similar problems, you are facing. If you get
the answers can you let me know.

My email address is s_v...@yahoo.com

Subrahmanyam A. Vaddi

0 new messages