Hi, I have a requirement to insert data into a column that is defined as LONG. We are using Oracle 7.3.4.. I am unable to insert more than 2000 characters into this table. To insert this I had to write a stored procedure that did the Insert. A simple insert woudnt work. The data to be inserted is entered using a web form. I also have a problem of retrieving the data. I have to display the data using a javaservlet. Any Suggestions are most welcome. Srihari
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
To get and set values in a ResultSet or PreparedStatement for a column of type LONG (known as LONGVARCHAR in java.sql.Types) the preferred methods are usually getCharacterStream(Reader) and setCharacterStream(Writer). If you're currently using a Statement rather than a PreparedStatement, it may be worthwhile to switch so that you can use the above set method, which avoids the need to create a single huge String object in memory for this field (which may be larger than some database drivers are able to handle). Or maybe your problem is completely unrelated; I'm just guessing here. Good luck...
I believe that 2000 char's is the the limit on that version of Oracle. Anything beyond that and you have to use CLOB's or BLOB's in the manner that Jim describes. Research you question using this info and you should find some samples of inserting and retrieving CLOB data. Sean
Joined: Jan 05, 2001
Thanks guys, for your suggestions. The problem with the simple insert is due to the version of Oracle. Instead of a simple insert , I now use a stored procedure and call it directly from NetDynamics which is the application server we use. I was earlier trying to use a shell script to call the procedure. NetDynamics also has a limit some where around 40000 characters. But my requirement is usually between 10000 to 20000 so I am safe there.