cancel
Showing results for 
Search instead for 
Did you mean: 

Error in using setClob method on PreparedStmt (using ngdbc.jar - version 2.4.67)

0 Kudos
282

SAP HANA DB version - 2.0SP3

ngdbc.jar version - 2.4.67

I am trying to use setClob on PreparedStmt and I am getting error "com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Cannot convert Java type java.sql.Clob to SQL type CHAR."

I came across a link where it states that createClob() of Connection is not supported in ngdbc driver (https://answers.sap.com/questions/512100/method-createclob-of-connection-is-not-supported-i.html), and as a work around an answer is proposed. I made use of that code snippet and I am trying to set Parameter using setClob.

String value = 'ABC';
PreparedStatement dummyclob = conn.prepareStatement("SELECT TO_CLOB ('" + value + "') FROM DUMMY;");
ResultSet rs = dummyclob.executeQuery();
Clob objClob = null;
if (rs.next()) {
	objClob = rs.getClob(1);
   }
pstmt.setClob(i+1, objClob);

at setClob I am getting error as "com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Cannot convert Java type java.sql.Clob to SQL type CHAR."

Can anyone help me with solution to this?

Accepted Solutions (0)

Answers (0)