You can't insert large data into Oracle directly.  If you want to use a CLOB to store your large amount of data you CAN do it with a bean, but you have to use some of the procedures imbeded in Oracle to deal with LOB data.  An example would be something like this:

public int insertClob( int idColumn, String clobData )
    throws SQLException
    {
        Connection conn = getConnection();
        try
        {
            // insert empty CLOB
            String theSql = "INSERT INTO theTable (id, clobColumn) VALUES (" + idColumn + ", EMPTY_CLOB())";
            Statement stmt = conn.createStatement();
            stmt.executeUpdate( theSql );

            // get CLOB locator
            theSql = "SELECT clobColumn FROM  theTable WHERE id  = " + idColumn + " FOR UPDATE";
            OracleResultSet rs = (OracleResultSet)stmt.executeQuery( theSql );
            rs.next();
            CLOB clob = rs.getCLOB( 1 );
            clob.putChars( 1, clobData.toCharArray() );

            // cleanup
            clob = null;
            rs.close();
            rs = null;
            stmt.close();
            stmt = null;
        }
        finally
        {
            returnConnection();
        }
        return 1;
    }

Gregory Scott wrote:
[EMAIL PROTECTED]">




You can also look at the 8.1.7 online docs for java examples or now the 9i online docs.  Sign up with Otn.oracle.com, and get a free account, get tons of examples.

If you are always going to use an Oracle database, then optimal performance will come from  the thick driver. However, the thin driver is the most frequently used.




>From: "The elephantwalker" >Reply-To: Orion-Interest >To: Orion-Interest >Subject: RE: Oracle questions (Slightly OT) >Date: Thu, 13 Sep 2001 09:27:28 -0700 > >You will have to use clob's to store large strings in oracle. > >Go to www.elephantwalker.com and login. If you don't have an account, create >one...its free. > >Go to this request http://www.elephantwalker.com/rfa?id=86 > >There you can download a stateless session bean and oracle dao to store >large strings in oracle. A version of this bean is used on the site, and we >have tested it with EXTREMELY large strings. > >I would not use any odbc bridge to do this....a real waste of time. > >Regards, > >the elephantwalker > > > > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED]]On Behalf Of Lachezar >Dobrev >Sent: Thursday, September 13, 2001 8:51 AM >To: Orion-Interest >Subject: Oracle questions (Slightly OT) > > > Hello group. > I have urgent need of advise. > I use an Oracle DB. And I have problems. > > 1. When using a ThinDriver I can not save large strings, and it is a must >for me. > 2. When using Oracle-Odbc-Jdbc-Ejb I can save the large strings, but... >Orion gets a lot of SQL exceptions, because of 'invalid character'. My >research shows, that while Oracle uses a DOT to express float numbers >(123.456) the jdbc-odbc bridge happens to use the COMMA for the delimiter, >because of my LOCAL settings. Then it just blows up steam. > > So. My question is like is there any non-ODBC-using driver for Oracle, >that can handle large strings? > > I'm in an urgent need for help, because the LOCAL settings change is not >an option. > > Please any advice. PLEASE! > > Lachezar > > > >


Get your FREE download of MSN Explorer at http://explorer.msn.com

Reply via email to