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

java.sql.SQLException Protocol Violation

248 views
Skip to first unread message

Prudhvi

unread,
Nov 19, 2001, 11:56:30 PM11/19/01
to
hi
I am writing a program using jdbc on linux.
my code is
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","username","passwd");

I am getting following exception.
I could able to connect using sqlplus and tnslistener is working
properly

can anybody please tell me what the problem is

java.sql.SQLException: Protocol violation
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:803)
at oracle.jdbc.ttc7.O3log.receive2nd(O3log.java:520)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:230)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:198) at
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
at java.sql.DriverManager.getConnection(DriverManager.java:457)
at java.sql.DriverManager.getConnection(DriverManager.java:137)
at Temp.main(Temp.java:7)

sincere thanks
prudhvi

C. Ferguson

unread,
Nov 20, 2001, 3:06:45 AM11/20/01
to
Hi,
well no db version...so...

1) try DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); instead of the Class.forName()

I've seen exceptions thrown when using Class.forName notation in a signed applet.
I've recently seen exceptions thrown when using Class.forName notation in a servlet that was connecting
to a 9i database...sigh
Flipped it to using the DriverManager.registerDriver notation and the db was happy.

2) verify that tcp/ip is on the database server machine.

3) Is line 7 of your code Connection con = ...?

4) verify that the database is listening on port 1521...look in the listerner.ora file.

hth,
cindy

mkowales

unread,
Nov 20, 2001, 8:49:25 AM11/20/01
to
your oracle client (driver) does not match the oracle server
(database). for example, you are trying to use oracle driver 8.0.6
against an oracle 8.1.? database. upgrade your driver by replacing
classes111.zip w/ classes12.zip.
0 new messages