JDBC, Oracle and Clob question.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: JDBC, Oracle and Clob question.

  1. #1
    James Guest

    JDBC, Oracle and Clob question.

    Hello All,

    I am completely stumped. I am using Forte, Java JDK 1.3 and JDBC. I
    have been trying for a few days now to enter text into a clob field in
    a Oracle 8.1.7 table. I cannot figure this out. Does anyone have any
    sample code or anything that I could look at to figure this out.

    What I am doing is parsing a very large file in ram then wanting to
    save the pasred protions to the database. The variable can be
    anywhere from 1K - 20K in size. If I could use a varchar2 this would
    be a breeze.

    Please give me a hand as I am going nuts.

    I am using the

    java.sql.*;

    for the database connectivity and the oracle thin client driver.

    Thanks,

    James.

  2. #2
    Paul Clapham Guest

    Re: JDBC, Oracle and Clob question.

    Here's the SQL that I use in my PreparedStatement:

    "Update SightingEntry set Notes = ? where Number = ?"

    And here's a fragment of code I use to update a Memo field in MS Access
    (which is about the same as what you describe) to write out a StringBuffer
    called "notes";

    byte[] bytes = notes.toString().getBytes();
    if (bytes.length == 0) {
    updateNotesStmt.setString(1, "");
    } else {
    InputStream is = new ByteArrayInputStream(bytes);
    updateNotesStmt.setAsciiStream(1, is, bytes.length);
    }
    updateNotesStmt.setInt(2, getNumber());
    updateNotesStmt.executeUpdate();

    (The special processing for zero-length strings was necessary because of
    what I think is a bug in either MS Access or the JDBC driver. You may not
    need that.)

    PC2

    James <java2e@yahoo.com> wrote in message
    news:3a9b6005.31180785@news.devx.com...
    > Hello All,
    >
    > I am completely stumped. I am using Forte, Java JDK 1.3 and JDBC. I
    > have been trying for a few days now to enter text into a clob field in
    > a Oracle 8.1.7 table. I cannot figure this out. Does anyone have any
    > sample code or anything that I could look at to figure this out.
    >
    > What I am doing is parsing a very large file in ram then wanting to
    > save the pasred protions to the database. The variable can be
    > anywhere from 1K - 20K in size. If I could use a varchar2 this would
    > be a breeze.
    >
    > Please give me a hand as I am going nuts.
    >
    > I am using the
    >
    > java.sql.*;
    >
    > for the database connectivity and the oracle thin client driver.
    >
    > Thanks,
    >
    > James.




  3. #3
    James Guest

    Re: JDBC, Oracle and Clob question.

    Thank you so much for the help. I have to give this a shot.

    Thanks,

    Kev.-

    On Tue, 27 Feb 2001 08:08:59 -0800, "Paul Clapham"
    <pclapham@core-mark.com> wrote:

    >Here's the SQL that I use in my PreparedStatement:
    >
    >"Update SightingEntry set Notes = ? where Number = ?"
    >
    >And here's a fragment of code I use to update a Memo field in MS Access
    >(which is about the same as what you describe) to write out a StringBuffer
    >called "notes";
    >
    > byte[] bytes = notes.toString().getBytes();
    > if (bytes.length == 0) {
    > updateNotesStmt.setString(1, "");
    > } else {
    > InputStream is = new ByteArrayInputStream(bytes);
    > updateNotesStmt.setAsciiStream(1, is, bytes.length);
    > }
    > updateNotesStmt.setInt(2, getNumber());
    > updateNotesStmt.executeUpdate();
    >
    >(The special processing for zero-length strings was necessary because of
    >what I think is a bug in either MS Access or the JDBC driver. You may not
    >need that.)
    >
    >PC2
    >
    >James <java2e@yahoo.com> wrote in message
    >news:3a9b6005.31180785@news.devx.com...
    >> Hello All,
    >>
    >> I am completely stumped. I am using Forte, Java JDK 1.3 and JDBC. I
    >> have been trying for a few days now to enter text into a clob field in
    >> a Oracle 8.1.7 table. I cannot figure this out. Does anyone have any
    >> sample code or anything that I could look at to figure this out.
    >>
    >> What I am doing is parsing a very large file in ram then wanting to
    >> save the pasred protions to the database. The variable can be
    >> anywhere from 1K - 20K in size. If I could use a varchar2 this would
    >> be a breeze.
    >>
    >> Please give me a hand as I am going nuts.
    >>
    >> I am using the
    >>
    >> java.sql.*;
    >>
    >> for the database connectivity and the oracle thin client driver.
    >>
    >> Thanks,
    >>
    >> James.

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center