DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: I am getting following error ORA-00911 when inserting value for CLOB object.

  1. #1
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    15
    I am getting ORA-00911 error when inserting a value into CLOB object. Does anybody have any idea what the problem or solution is to the below code. Thanks for all the help.
    -----------------------------------------------------------------------


    import java.util.*;
    import java.sql.*;
    import java.lang.* ;
    import java.io.ByteArrayInputStream ;
    import oracle.jdbc.driver.*;
    import oracle.jdbc.* ;


    public class TestClob {

    public TestClob () {
    getConnection() ;
    }

    public void getConnection(){
    java.util.Properties props = new java.util.Properties();
    props.put("user", "scott");
    props.put("password", "tiger");
    try
    {
    java.sql.Driver d = (java.sql.Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    java.sql.Connection conn = d.connect("jdbcracle:thin:@server.com:1521:instance", props);

    PreparedStatement stmt = conn.prepareStatement(
    "insert into TESTCLOB ( col1, clobcol )" +
    " values ( 'hello', ? ); "
    );
    int index = 1 ;
    String xml = new String("Big XML Document") ;
    stmt.setAsciiStream(index++, new ByteArrayInputStream( xml.getBytes() ), xml.length() );
    // stmt.setBinaryStream(index++, new ByteArrayInputStream( xml.getBytes() ), xml.length() );

    stmt.executeUpdate();

    stmt.close();
    }
    catch (SQLException e) {
    System.out.println ( "SQLexception " + e ) ;
    }
    catch ( IllegalAccessException ie ) {
    System.out.println ( "IllegalAccessException " + ie ) ;
    }
    catch (InstantiationException iie) {
    System.out.println ( "InstantiationException " + iie ) ;
    }
    catch (ClassNotFoundException cn) {
    System.out.println ( "ClassNotFoundException " + cn ) ;
    }

    return ;
    } // end of getConnection

    public static void main ( String[] args ) {
    TestClob tc = new TestClob();

    } // end of main

    }



  2. #2
    Join Date
    Aug 2001
    Location
    Waterloo, On
    Posts
    547
    An excerpt from Oracle Documentation:

    ORA-00911 invalid character

    Cause: Special characters are valid only in certain places. If special characters other than $, _, and # are used in a name and the name is not enclosed in double quotation marks ("), this message will be issued. One exception to this rule is for database names; in this case, double quotes are stripped out and ignored.

    Action: Remove the invalid character from the statement or enclose the object name in double quotation marks.

    Check out which special characters are invalid!


    Raminder Singh

    Oracle Certified DBA: Oracle 8i, 9i


    Mail me at raminderahluwalia@rediffmail.com.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width