You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Martin Kalén <ma...@curalia.se> on 2003/12/11 11:59:44 UTC

Oracle9i platform in upcoming 1.0RC5 breaks LOB-support with oracle:thin

Greetings developers,
	the new PlatformOracle9iImpl has some very strange code for handling 
the flag "[GS]ET_CLOB_AND_LOB_SUPPORTED".

This flag is initialized to false and the logic to enable it is embedded 
in flow like the following:

flag = false
if (otherCondition && flag is true)
then
	check if we can set flag = true
fi


This results in regression if switching from OJB1.0RC4 platform=Oracle 
to 1.0preRC5(CVS) and platform=Oracle9i, since the code to set CLOB-data 
in prepared statements is something like:

if (datatype is <other datatypes>)
then
	process other datatypes
else if (datatype is CLOB and content is String)
then
	if (SET_CLOB_AND_LOB_SUPPORTED)
	then
		set CLOB-data in PreparedStatemend
	fi
else
	pass handling on to superclass (OracleImpl)
fi

There are two obvious issues with this approach:
1) SET_CLOB_AND_BLOB_SUPPORTED cannot ever be set to true according to 
the semantics from above
2) Even if SET_CLOB_AND_BLOB_SUPPORTED is set correctly, the break-out 
from the main if-else-flow into "if (SET_CLOB_AND_LOB_SUPPORTED)" means 
a silent NO-OP fallthrough when SET_CLOB_AND_LOB_SUPPORTED=false 
resulting in INSERT failures since the prepared statement did not get 
all it's data
"JdbcAccessImpl: SQLException during the execution of the insert
  java.sql.SQLException: ORA-01008: not all variables bound"


The patch attached to this mail modifies PlatformOracle9iImpl in two 
ways, it:
1) fixes [GS]ET_CLOB_AND_LOB_SUPPORTED semantics so that they are set 
correctly
2) joins the if-conditions for CLOB and BLOB datatypes in 
setObjectForStatement() so that fall-through for oracle:thin is 
backwards compatible with OJB1.0RC4 and does not break prepared statements

I couldn't find the issue in Scarab that PlatformOracle9iImpl originated 
from (if there was one?), so I post the patch directly to the list. Hope 
that's OK.

The Oracle9i-specific stuff is really interesting, and it would be great 
if it was working for both OCI and thin in RC5/1.0.

Regards,
  Martin

-- 
Martin Kalén
Curalia AB              Web:  http://www.curalia.se
Orrspelsvägen 2B        Mail: info@curalia.se
SE-182 79  Stocksund    Tel:  +46-8-410 064 40


Re: Oracle9i platform in upcoming 1.0RC5 breaks LOB-support with oracle:thin

Posted by Erik Forkalsrud <er...@cj.com>.

I tried your patch and had some success with CLOBs and the Oracle
thin driver.  I guess I had a buggy JDBC driver, but when I
downloaded the latest from otn.oracle.com things started to work
better -- at least for CLOBs.

(A "good" version of the Oracle thin driver can be obtained from
http://otn.oracle.com/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
I downloaded the Oracle9i 9.2.0.3 JDBC Driver for JDK 1.4)

However, BLOBs still gave me problems,  ("wrong number of
arguments" in some reflection code)  and when I stared reading
the code, I saw a lot of code for CLOBs that didn't have a BLOB
counter part.   So I started copying and editing thos methods
until I got BLOBs working as well.  The resulting patch is
applied if anyone is interested.


Erik Forkalsrud
erik@cj.com


On Thu, 11 Dec 2003, [ISO-8859-1] Martin Kalén wrote:

> Greetings developers,
> 	the new PlatformOracle9iImpl has some very strange code for handling
> the flag "[GS]ET_CLOB_AND_LOB_SUPPORTED".
>
> This flag is initialized to false and the logic to enable it is embedded
> in flow like the following:
>
> flag = false
> if (otherCondition && flag is true)
> then
> 	check if we can set flag = true
> fi
>
>
> This results in regression if switching from OJB1.0RC4 platform=Oracle
> to 1.0preRC5(CVS) and platform=Oracle9i, since the code to set CLOB-data
> in prepared statements is something like:
>
> if (datatype is <other datatypes>)
> then
> 	process other datatypes
> else if (datatype is CLOB and content is String)
> then
> 	if (SET_CLOB_AND_LOB_SUPPORTED)
> 	then
> 		set CLOB-data in PreparedStatemend
> 	fi
> else
> 	pass handling on to superclass (OracleImpl)
> fi
>
> There are two obvious issues with this approach:
> 1) SET_CLOB_AND_BLOB_SUPPORTED cannot ever be set to true according to
> the semantics from above
> 2) Even if SET_CLOB_AND_BLOB_SUPPORTED is set correctly, the break-out
> from the main if-else-flow into "if (SET_CLOB_AND_LOB_SUPPORTED)" means
> a silent NO-OP fallthrough when SET_CLOB_AND_LOB_SUPPORTED=false
> resulting in INSERT failures since the prepared statement did not get
> all it's data
> "JdbcAccessImpl: SQLException during the execution of the insert
>   java.sql.SQLException: ORA-01008: not all variables bound"
>
>
> The patch attached to this mail modifies PlatformOracle9iImpl in two
> ways, it:
> 1) fixes [GS]ET_CLOB_AND_LOB_SUPPORTED semantics so that they are set
> correctly
> 2) joins the if-conditions for CLOB and BLOB datatypes in
> setObjectForStatement() so that fall-through for oracle:thin is
> backwards compatible with OJB1.0RC4 and does not break prepared statements
>
> I couldn't find the issue in Scarab that PlatformOracle9iImpl originated
> from (if there was one?), so I post the patch directly to the list. Hope
> that's OK.
>
> The Oracle9i-specific stuff is really interesting, and it would be great
> if it was working for both OCI and thin in RC5/1.0.
>
> Regards,
>   Martin
>
> --
> Martin Kal\x{FFFD}n
> Curalia AB              Web:  http://www.curalia.se
> Orrspelsv\x{FFFD}gen 2B        Mail: info@curalia.se
> SE-182 79  Stocksund    Tel:  +46-8-410 064 40
>
>