on 07-01-2008 11:34 AM
Hi ,
How to insert XML file into MAXDB . I have piece of code shown below but it is throwing UnSupportedException .
java.lang.UnsupportedOperationException: Method setAsciiStream(int, InputStream, int) is not supported by Open JDBC
public void insertClobRecord() throws SQLException, FileNotFoundException
{
PreparedStatement insertRecord = null;
Statement stmt = null;
FileOutputStream outputFileOutputStream = null;
OutputStreamWriter outputOutputStreamWriter = null;
BufferedWriter outputBufferedWriter = null;
String sqlText = null;
FileInputStream inputFileInputStream = null;
String insertString = "INSERT INTO ITSAM_CLOB (ID, FILENAME, XML_DOC) VALUES ( ? , ?, ?)";
insertRecord = connection.prepareStatement(insertString);
insertRecord.setLong(1, getLog_key());
insertRecord.setString(2, "test.xml");
ResultSet rs = null;
File inputTextFileName = new File("c:
dbtest
export.xml");
if(inputTextFileName.exists())
{
logger.errorT(" File Exists");
}
inputFileInputStream = new FileInputStream(inputTextFileName);
insertRecord.setAsciiStream(3, inputFileInputStream, (int)inputTextFileName.length());
int rowInserted = insertRecord.executeUpdate();
insertRecord.close();
}
Could anyone please let me know how to i go about it ..
Thanks & Regards,
Mitul Adhia.
Hi,
the complete documentation of Open JDBC can you find at
[http://help.sap.com/saphelp_webas630/helpdata/en/61/703248d3ce9f43ba97cfbe11a8bc9f/content.htm|http://help.sap.com/saphelp_webas630/helpdata/en/61/703248d3ce9f43ba97cfbe11a8bc9f/content.htm].
If you click on the small image with the two red arrows you will get a navigation menu on the left side.
Best regards,
Marco
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you got the exception from Open JDBC what is a wrapper around the database vender JDBC driver. Like you can see in the [documentation of Open JDBC|http://help.sap.com/saphelp_webas630/helpdata/en/d0/c4d94c5df740ec9d6dca64f4709de2/content.htm] the API method setAsciiStream(...) isn't supported. You should use setCharacterStream( int, Reader, int ) instead.
java.io.FileReader inputFileInputStream = new java.io.FileReader(inputTextFileName);
insertRecord.setCharacterStream(3, inputFileInputStream, (int)inputTextFileNamelength());
Best regards,
Marco
Marco Paskamp
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks alot Marco ...one more help from you ... could you please fwd me the start link of open JDBC documentation ....i m looking for the complete documentation online for open JDBC ...I want to assign you rewards point but i could not locate the way to do the needful.
Thanks & Regards,
Mitul Adhia.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.