• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inserting and retrieving LONG data

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What was the problem with the simple insert?
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please provide some code and error messages.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
author
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic