db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: PreparedStatement problem with big BLOBS
Date Mon, 24 Sep 2007 13:45:57 GMT
>>>>>>>>>>>> Kathey Marsden wrote (2007-09-21 09:14:50):
> Mikael wrote:
> >Hi !
> > 
> >I have a pretty weird problem, I use a Derby 10.3.1.4 with the 
> >ClientDriver and I run the code below:
> > 
> >    // Data is a byte[] vector
> >    ByteArrayInputStream is = new ByteArrayInputStream( data);    
> >    String sql = "UPDATE MyTable SET FContents=? WHERE FName='" + name 
> >+ "'";
> >    PreparedStatement ps = conn.prepareStatement( sql);
> >    ps.setBinaryStream( 1, is, data.length);
> >    
> >    if( ps.executeUpdate() == 0)
> >    {
> >        // it throws an exception here if the data array us larger 
> >then around 32750 bytes!!!
> >    }
> > 
> >Connection is "jdbc:derby://localhost/mydb;create=true;"
> >
> >java.sql.SQLException: A network protocol error was encountered and 
> >the connection has been terminated: A PROTOCOL Data Stream Syntax 
> >Error was detected.  Reason: 0x0. Plaintext connection attempt to an 
> >SSL enabled server?
> >        at 
> >org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> >Source)
> >        at 
> >org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
> >        at 
> >org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown Source)
> >The table is defined as:
> >    CREATE TABLE MyTable (FName varchar(300) NOT NULL,FContents 
> >BLOB(16M) NOT NULL)
> > 
> >I do not understand why it only works with small BLOB contents, as 
> >soon as I pass 32750 bytes or so the above happens,
> >when data is 32750 or smaller it works just fine.
> > 
> Hello Mikal.   The error seems related to an SSL enabled server, but it 
> would seem that you would get that error at connection time, not when 
> inserting into the table.  I tried the following program just starting 
> network server normally java org.apache.derby.drda.NetworkServerControl 
> start and it seemed to run ok.  Can you tell me how to modify this 
> program or the way I started the server to reproduce your error?

The client error message "A network protocol error was encountered and 
the connection has been terminated: A PROTOCOL Data Stream Syntax 
Error was detected.  Reason: 0x0. Plaintext connection attempt to an 
SSL enabled server?" will be thrown in 3 possible cases
1) A buggy DRDA data stream was sent from the server
2) A plaintext client tries to connect to an SSL enabled server
3) A plaintext client tries to connect to any other server which does
not talk DRDA.

So that's why the question mark is there. I assume Mikael hits case
#1 and no SSL is involved.

-- 
Bernt Marius Johnsen, Database Technology Group, 
Staff Engineer, Derby/Java DB
Sun Microsystems, Trondheim, Norway

Mime
View raw message