I need to write an XML file content into oracle database where the column is of CLOB datatype. How will I do that?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
With about 100 lines of code ;-) Here is an example.
The main point: Unlike with other JDBC drivers, the one from Oracle doesn't support using
Reader
andInputStream
as parameters of anINSERT
. Instead, you mustSELECT
theCLOB
columnFOR UPDATE
and then write into theResultSet
I suggest that you move this code into a helper method/class. Otherwise, it will pollute the rest of your code.
You can very well do it with below code, i am giving you just the code to insert xml hope u are done with rest of other things..
I have done like this and it is working fine.
Try this , there is no need to set its a CLOB
The easiest way is to simply use the
methods (for "small" strings which can be easily kept in Java memory), or
This code worked for me. I use ojdbc6-11.2.0.2.jar.
Take a look at the LobBasicSample for an example to use CLOB, BLOB, NLOB datatypes.