File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes Clobs, Stored procedures and Oracle 8i Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Clobs, Stored procedures and Oracle 8i" Watch "Clobs, Stored procedures and Oracle 8i" New topic

Clobs, Stored procedures and Oracle 8i

J Rosetto

Joined: Jun 03, 2008
Posts: 21
I have a stored procedure which takes in a Clob as one of IN arguments:

PROCEDURE clob_processor(p_c_frag IN CLOB)

I can run the following code against an Oracle 10g database with no problems:

Connection connection = DatabaseHandler.getInstance().getConnection();
CallableStatement statement = connection.prepareCall("call TEST.CLOB_PROCESSOR.clob_processor (?)");
statement.setString("my clob string");

However, when I run this same code on Oracle 8i I get the following error:

Exception in thread "main" java.sql.SQLException: ORA-06553: P LS-306: wrong number or types of arguments in call to 'CLOB_PROCESSOR'

Unfortunately I cannot find any way to create a CLOB object to encapsulate my String. There are a couple of createTemporary() methods which can do this, but unfortunately they don't seem to work, as I am using an Apache DBCP connection wrapper.

Does anyone know any other way of generating clobs, or obtaining the wrapped connection from within a DBCP wrapper?
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30138

I've never used setString() with a CLOB. I've also never created an actual CLOB. Instead I use setAsciiStream() on the prepared statement.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
It is sorta covered in the JavaRanch Style Guide.
subject: Clobs, Stored procedures and Oracle 8i
Similar Threads
How to read CLOB data from oracle database.
Apache Commons DBCP connection object problem
getting ResultSet from Java Stored Procedure
Weblogic Connection Pool, Oracle Stored Procedure, Remote Sybase Database
Using Clobs in SQLServer- Please help!