Java programming

Hi,

I have written a call to a procedure which returns me an XML output. The output is of type CLOB.

I had tried using a getString(). My output datatype was CLOB. When i did so the XML output on Java side was returning me NULL. I resolved the issue by using clob object. But why did using getString() fail?

[326 byte] By [Kripaa] at [2007-11-27 4:30:49]
# 1

> Hi,

>

> I have written a call to a procedure which returns me

> an XML output. The output is of type CLOB.

>

> I had tried using a getString(). My output datatype

> was CLOB. When i did so the XML output on Java side

> was returning me NULL. I resolved the issue by using

> clob object. But why did using getString() fail?

Because there is a bug in the driver. Complain to the driver vendor.

cotton.ma at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 2
Does it mean that i can get the output by using getString() even if the datatype is CLOB?
Kripaa at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 3

>

> Because there is a bug in the driver. Complain to the

> driver vendor.

To clarify it is not a bug to have a situation where getString would not work but it is a bug if that has wrong behaviour instead. The driver in your case should be throwing a SQLException if an attempt is made to read the field in an inappropriate manner not return null.

PS you are another one today with a just terrible subject line. Please use meaningful and specific subject lines. Java programming is not a specific subject line on this site.

cotton.ma at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 4
> Does it mean that i can get the output by using> getString() even if the datatype is CLOB?Maybe not. The bug is that it should not be returning null.
cotton.ma at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 5
What about using this? Clob getClob
BIJ001a at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 6
> What about using this? > > Clob getClob> I am pretty sure he is doing that, and that is working. I think the question is just why getString does not work.
cotton.ma at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 7

It is up to the drevier to what extent it is willing to convert between different data types.

Whereas an older Oracle driver converted silently between numeric and string parameters, that is, it accepted the VARCHAR type to be bound to a stored procedure parameter which was actually numeric, and setString worked on it (provided the value was okay), a later version choked on it.

BIJ001a at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 8

> It is up to the drevier to what extent it is willing

> to convert between different data types.

>

Hello?

I stated this several times already.

It is WRONG however for a driver to silently return a null when it gets a request for conversion that it doesn't want or is unable to do.

That's why it is a bug. Not because it isn't doing the conversion. Because it is returning an incorrect value. It would not be a bug if it was throwing a SQLException.

cotton.ma at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...
# 9
> Hello?I experienced the phenomenon I described in the hard way in a production environment. I thought it was useful to put down this hint. Hello!
BIJ001a at 2007-7-12 9:40:11 > top of Java-index,Java Essentials,Java Programming...