• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inserting and retrieving LONG data

 
Srihari Injeti
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 java servlet.
Any Suggestions are most welcome.
Srihari
 
marilyn murphy
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What was the problem with the simple insert?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide some code and error messages.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Srihari Injeti
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

------------------
Srihari Injeti
SCJP2 MCP CIW
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic