Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Type conflict while saving XML

 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about posting the stack trace?
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here is the stack trace.



Thanks.
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the UPD_ENCOUNTER stored procedure signature and how you call it?
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks.
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic