aspose file tools*
The moose likes JDBC and the fly likes Type conflict while saving XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Type conflict while saving XML" Watch "Type conflict while saving XML" New topic
Author

Type conflict while saving XML

jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi,

I am getting type conflict error while saving the XML in to the database it only happens some times not always. I build the xml and update some fields same structure same elements only data changes.

This is what I am doing
statement.registerOutParameter(++fieldCount, Types.CLOB);.

I was able to fix this by doing this in the following way



If there is any exception occurs every time i have to change indentation. This is odd if I get exception I have to change this.

Thanks for the help in advance.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

What is the type of the field you're storing the XML string in? Is it CLOB? Or is it VARCHAR with a size that's perhaps too small?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi,

I am storing it as a CLOB and datatype is CLOB. Size is not a problem if I send a bigger XML also it works fine as I mentioned it happens some times.

Thanks,
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

How about posting the stack trace?
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi,

Here is the stack trace.



Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Can you show the UPD_ENCOUNTER stored procedure signature and how you call it?
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi,

Here is the procedure method call
Please let me know I want to delete the code after your review.

Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Right. Either your stored procedure takes more or less than 23 parameters, or there is a type mismatch.

Let's recap (only positions and types):
1: integer
2: integer
3: integer
4: timestamp (date/time)
5: integer
6: integer
7: integer
8: string (varchar)
9: integer
10: integer
11: string (varchar)
12: string (varchar)
13: string (varchar)
14: timestamp (date/time)
15: string (varchar)
16: timestamp (date/time)
17: integer
18: integer

That's the input part. The registered output parameters match these. Then there's another integer, integer, varchar, varchar and varchar for output parameters.

Maybe the problem is using parameters for both input and output; I don't know if that's allowed or not.
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi,

I see what you mean. This is my situation we simply build the vo and send it to this method. This method works for some xmls but not working for in some times.

In that this should throw the exception for all vo's but not working for few vo's with the same data.

Thanks,
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Where in the Sql are you defining the returned result ??

A CallableStatement is normally called like this {? = call procedure_name[(?, ?, ...)]} where the first ? is the result of the call.

Or maybe your procedure is not defined 'good enough' - does the parameter list have the right IN, OUT and/or INOUT ??


Regards, Rene Larsen
Dropbox Invite
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Type conflict while saving XML