Help! Weblogic8.1 and Oracle 8i caused ORA-01461 exception

Discussions

EJB programming & troubleshooting: Help! Weblogic8.1 and Oracle 8i caused ORA-01461 exception

  1. Using Weblogic 8.1, Oracle 8i and Weblogic's jDriver JDBC driver, a simple EJB program throws the following exception when a new entity bean is created.

    java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column".
    </p>
    The primary key field of the table is a NUMBER field. The field is defined as java.lang.Integer in the entity bean. The same program can be deployed to OC4J and JBoss with out problems at all.

    Any help would be appreciated! Thanks in advance!
    Vincent.
    </p>
  2. reply[ Go to top ]

    Vincent,

    Looks like JDBC driver maps Java Integer to Oracle LONG somehow (and that is quite strange!).

    Probably, the best option of generation primary keys would be to use Oracle sequence and use Automatic sequence-based key generator which is supported by Weblogic. That will definetely sort out your problem.

    Alex
  3. Are you convinced that You use correct Oracle driver, while Weblogic is up. WLS 8.1 adds in CLASSPATH ojdbc.jar ,which is latest oracle driver for Oracle 9>. Check it out and replace with classes12.jar.