Hello.
Knut Anders Hatlen (JIRA) wrote:
However, compatibility with older servers seems to have been broken. When I try to stream
a lob (small enough to fit in the client's memory) to a 10.2.1.6 server, I get a protocol
error: "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." I think we need to check the version of the server before using layer
b streaming. This could be done in NetDatabaseMetaData.computeFeatureSet_().
I see.
I will add one more condition for executing layer B streaming from
client driver.
if (stream == null) {
// same code as before for null
} else if (stream instanceof LayerBStreamedEXTDTAReaderInputStream) {
// new Layer B code
} else {
// same code as in the old else-clause
}
The main point is that we should have an "else" clause at the end which catches all cases, instead
of only having "if" and "else if" clauses. I think that it will make the code clearer,
since a reader doesn't have to figure out whether there are cases that don't match any of the if/else-if
clauses.
See ...
I want to state explicitly that stream is instance of
LayerBStreamedEXTDTAReaderInputStream or StandardEXTDTAReaderInputStream.
Now I think what is needed is the last else clause as error processing.
Best regards.
Knut Anders Hatlen (JIRA) wrote:
[ http://issues.apache.org/jira/browse/DERBY-1471?page=comments#action_12458092 ]
Knut Anders Hatlen commented on DERBY-1471:
-------------------------------------------
I have tested the lengthless versions of PreparedStatement.setClob(),
PreparedStatement.setCharacterStream(), PreparedStatement.setAsciiStream(),
PreparedStatement.setBlob(), PreparedStatement.setBinaryStream(),
ResultSet.updateClob(), ResultSet.updateCharacterStream(),
ResultSet.updateAsciiStream(), ResultSet.updateBlob() and
ResultSet.updateBinaryStream(), and they all seem to work without throwing
OutOfMemoryError for large lobs. Great! :)
However, compatibility with older servers seems to have been broken. When I try to stream
a lob (small enough to fit in the client's memory) to a 10.2.1.6 server, I get a protocol
error: "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." I think we need to check the version of the server before using layer
b streaming. This could be done in NetDatabaseMetaData.computeFeatureSet_().
Thank you for addressing my previous comments. My comment about
readAndSetExtParam() was a bit unclear. What I meant, was that the if-clause
could be written as
if (stream == null) {
// same code as before for null
} else if (stream instanceof LayerBStreamedEXTDTAReaderInputStream) {
// new Layer B code
} else {
// same code as in the old else-clause
}
The main point is that we should have an "else" clause at the end which catches all cases, instead
of only having "if" and "else if" clauses. I think that it will make the code clearer,
since a reader doesn't have to figure out whether there are cases that don't match any of the if/else-if
clauses.
Implement layer B streaming for new methods defined in JDBC4.0
--------------------------------------------------------------
Key: DERBY-1471
URL: http://issues.apache.org/jira/browse/DERBY-1471
Project: Derby
Issue Type: New Feature
Components: Network Client
Reporter: Tomohito Nakayama
Assigned To: Tomohito Nakayama
Attachments: DERBY-1471.diff, DERBY-1471.patch, DERBY-1471.stat,
DERBY-1471_2.patch, DERBY-1471_2.stat, DERBY-1471_3.patch, DERBY-1471_3.stat,
DERBY-1471_4.patch, DERBY-1471_4.stat
JDBC 4.0 introduced new methods which take parameters for object to be sent to
sever without length information.
For those methods, Layer B streaming is best way to implement sending object to
server.
This issue is representation of DERBY-1417 in Network Client.
--
/*
Tomohito Nakayama
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Naka
http://www5.ocn.ne.jp/~tomohito/TopPage.html
*/