Home » Developer & Programmer » JDeveloper, Java & XML » Oracle 9: Protocol Violation (Blob)
Oracle 9: Protocol Violation (Blob) [message #92249] Wed, 05 May 2004 07:54 Go to next message
Hong Guy
Messages: 1
Registered: May 2004
Junior Member
Hi,

I installed Oracle 9.2.0.1 on my Windows 2000 Professional workstation. Oracle JDBC driver 9.2.0.1 was also installed. I am using JDK 1.4.2.

In the sample database, under PM schema, there is a table, PRINT_MEDIA. "AD_PHOTO" is a field of Blob type in this table.

After the Blob object is retrieved, there is no problem calling its isEmptyLob method. But I got an "Protocol Violation" exception when I tried to call its length method. Same problem happened to getBinaryStream method as well.

java.sql.SQLException: Protocol violation
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
        at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
        at oracle.jdbc.ttc7.v8TTILob.receiveReply(v8TTILob.java:994)
        at oracle.jdbc.ttc7.v8TTILob.getLength(v8TTILob.java:297)
        at oracle.jdbc.ttc7.TTC7Protocol.lobLength(TTC7Protocol.java:2595)
        at oracle.sql.LobDBAccessImpl.length(LobDBAccessImpl.java:104)
        at oracle.sql.BLOB.length(BLOB.java...

Any idea? Thanks in advance for your help.
Hong

==== Code (part) ======
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.sql.BLOB;

public class MyOracle {

  public static void main(String[[]] args)
       throws SQLException
  {
    int column1 = -1;

    try {
      DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver() );
      Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:databaseName", "userId", "password" );
     
      DatabaseMetaData meta = conn.getMetaData();
      Statement st = conn.createStatement();
      ResultSet rs = st.executeQuery( "select * from PM.PRINT_MEDIA" );

      while ( rs.next() )
      {
        column1= rs.getInt(1);
        oracle.sql.BLOB b = (oracle.sql.BLOB)rs.getBlob("AD_PHOTO");
        boolean bb = b.isEmptyLob(); // ok
        long longL = b.length(); // throw java.sql.SQLException: Protocol violation
        InputStream in = b.getBinaryStream(); // also failed
      }
      st.close();
    } catch( SQLException exq ) {
      exq.printStackTrace();
      System.exit(0);
    }   
  }
}
Re: Oracle 9: Protocol Violation (Blob) [message #92552 is a reply to message #92249] Tue, 14 September 2004 07:45 Go to previous messageGo to next message
Vijay
Messages: 116
Registered: September 1999
Senior Member
Hong,

I an experiencing a similar problem.
Were you able to find a fix for this?

tia,
Vijay
Re: Oracle 9: Protocol Violation (Blob) [message #157571 is a reply to message #92249] Fri, 03 February 2006 06:26 Go to previous message
yash203
Messages: 2
Registered: February 2006
Junior Member
to resolve this problem of protocl violation I downloaded the Oracle JDBC driver 9.2.0.3, the Protocol violation problem was resolved but then I sarted getting deadlock issue as follows:

Found one Java-level deadlock:
=============================
"Thread-34372":
waiting to lock monitor 0x003533e8 (object 0xbd102ab8, a oracle.jdbc.driver.OracleConnection),
which is held by "Thread-58"
"Thread-58":
waiting to lock monitor 0x00353378 (object 0xbd1052b0, a oracle.jdbc.ttc7.TTC7Protocol),
which is held by "Thread-34372"

Java stack information for the threads listed above:
===================================================
"Thread-34372":
at oracle.jdbc.driver.OracleConnection.needLine(OracleConnection.java:2389)
- waiting to lock <0xbd102ab8> (a oracle.jdbc.driver.OracleConnection)
at oracle.jdbc.ttc7.TTC7Protocol.getLobChunkSize(TTC7Protocol.java:2994)
- locked <0xbd1052b0> (a oracle.jdbc.ttc7.TTC7Protocol)
at oracle.sql.LobDBAccessImpl.getChunkSize(LobDBAccessImpl.java:323)
- locked <0xbe0c4238> (a oracle.sql.LobDBAccessImpl)
at oracle.sql.BLOB.getChunkSize(BLOB.java:484)
at oracle.sql.BLOB.getBufferSize(BLOB.java:521)
at oracle.sql.BLOB.getBinaryStream(BLOB.java:256)
at oracle.sql.BLOB.binaryStreamValue(BLOB.java:1171)
at oracle.jdbc.driver.OracleStatement.getBinaryStreamValue(OracleStatement.java:5671)
at oracle.jdbc.driver.OracleResultSetImpl.getBinaryStream(OracleResultSetImpl.java:746)
- locked <0xc3740bc8> (a oracle.jdbc.driver.OracleResultSetImpl)
at com.adventnet.db.util.ResultSetWrapper.getString(ResultSetWrapper.java:131)
at com.adventnet.nms.store.relational.RelationalObject.formProperties(RelationalObject.java:569)
at com.adventnet.nms.store.relational.RelationalObject.executeTheStatementAndGetTheProperties(RelationalObject.java:486)
at com.adventnet.nms.store.relational.RelationalObject.getObjectProperties(RelationalObject.java:689)
at com.adventnet.nms.store.relational.RelationalObject$ForGet.getObjectProperties(RelationalObject.java:1149)
- locked <0xbd324f70> (a com.adventnet.nms.store.relational.RelationalObject$ForGet)
at com.adventnet.nms.store.relational.RelationalObject.getObject(RelationalObject.java:544)
at com.adventnet.nms.store.relational.CommonTopoToRelational.getObject(CommonTopoToRelational.java:617)
at com.adventnet.nms.store.CommonDBStore.getFromDB(CommonDBStore.java:403)
at com.adventnet.nms.store.CommonDBStore.getObject(CommonDBStore.java:131)
at com.adventnet.nms.topodb.TopoDB.lockAndGetTheObject(TopoDB.java:430)
at com.adventnet.nms.topodb.TopoDB.checkOut(TopoDB.java:392)
at com.infinera.nm.ems.server.discovery.DiscoveryDBUtils.deleteObject(DiscoveryDBUtils.java:332)
at com.infinera.nm.ems.server.discovery.DeviceInterceptor.deleteExtraObjectsFromDatabase(DeviceInterceptor.java:2213)
at com.infinera.nm.ems.server.discovery.DeviceInterceptor.getAddAllObjectsToDB(DeviceInterceptor.java:402)
at com.infinera.nm.ems.server.discovery.DeviceInterceptor.addAllObjectsToDB(DeviceInterceptor.java:778)
at com.infinera.nm.ems.server.discovery.DeviceInterceptor.DoDiscovery(DeviceInterceptor.java:1888)
at com.infinera.nm.ems.server.discovery.DeviceInterceptor.DiscoverDevice(DeviceInterceptor.java:2010)
at com.infinera.nm.ems.server.discovery.DeepDiscovery$1.run(DeepDiscovery.java:163)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
at java.lang.Thread.run(Unknown Source)
"Thread-58":
at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:667)
- waiting to lock <0xbd1052b0> (a oracle.jdbc.ttc7.TTC7Protocol)
at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:700)
- locked <0xc3742148> (a oracle.jdbc.driver.OracleStatement)
- locked <0xbd102ab8> (a oracle.jdbc.driver.OracleConnection)
at com.adventnet.nms.db.SQLUtility.executeQuery(SQLUtility.java:365)
at com.adventnet.nms.fe.alert.AlertCustomViewUtility.getAlertCount(AlertCustomViewUtility.java:915)
at com.adventnet.nms.fe.alert.AlertSessionBean.getAlertCount(AlertSessionBean.java:377)
at com.adventnet.nms.startnms.AcClient.getRequiredCategoryData(AcClient.java:218)
at com.adventnet.nms.startnms.AcClient.send(AcClient.java:117)
at com.adventnet.nms.startnms.MainSocketClientFE.receive(MainSocketClientFE.java:820)
at com.adventnet.nms.startnms.MainSocketSessionBE.scheduleSend(MainSocketSessionBE.java:590)
- locked <0xbd9d9e38> (a com.adventnet.nms.startnms.MainSocketSessionBE)
at com.adventnet.nms.startnms.MainSocketSessionBE$SendToClient.run(MainSocketSessionBE.java:825)

Found 1 deadlock.


Any idea if this issue is fixed in the lated Oracle JDBC driver 9.2.0.5 ?

Regards,
Yashpal
Previous Topic: Loading large XML-Files into 9i
Next Topic: deadlock issue in jdbc driver 9.2.0.5
Goto Forum:
  


Current Time: Mon Nov 25 00:34:47 CST 2024