Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Protocol violation

843854Feb 6 2003 — edited Dec 16 2003
I am using Oracle 8.1.7 and java 1.2.2 and I am getting Protocol violation error.
I have this code working with another database which is located on different machine (which is test machine) Now I am trying to move code to another machine and it dosen't work. Both the machines have same OS and same version of oracle and java.

My code compiles fine but does not execute.
 class DBConnectionTest{
	
	public static void main(String args[]){
try{
  DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
		    Connection conn=
		    DriverManager.getConnection("jdbc:oracle:thin:@machine:1526:database","user", "password");
		    Statement stmt = conn.createStatement();
		    stmt.executeQuery("select sysdate from dual");
			
			System.out.println("Success");
   

    }

     catch (SQLException e){
			System.out.println("Failure");
			e.printStackTrace();
		}
		
	}
}
I put the classes111.zip and classes12.zip in path after looking at several posts but it still does not work...

This is the stack trace.


java.sql.SQLException: Protocol violation
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at java.sql.SQLException.<init>(SQLException.java:43)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:185)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:227)
at oracle.jdbc.dbaccess.DBError.check_error(Compiled Code)
at oracle.jdbc.ttc7.Oclose.receive(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:564)
at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:764)
at oracle.jdbc.dbaccess.DBAccess.setNlsParamsClient(DBAccess.java:1209)
at oracle.jdbc.ttc7.TTC7Protocol.initNls(TTC7Protocol.java:1222)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:397)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(Compiled Code)
at oracle.jdbc.driver.OracleDriver.connect(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at java.sql.DriverManager.getConnection(DriverManager.java:137)
at DBConnectionTest.main(DBConnectionTest.java:19)



Any one got any odea what else can I try?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2004
Added on Feb 6 2003
6 comments
376 views