Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle JDBC Thin Driver and Long Raw Columns

Oracle JDBC Thin Driver and Long Raw Columns

From: <christophercoshea_at_unn.unisys.com>
Date: 1998/02/02
Message-ID: <886456740.1430323205@dejanews.com>#1/1

I am trying to insert a file (image, word processing document, etc) into a long raw column using JDBC 7.3.4 thin drivers. We are using Oracle7 Server Release 7.2.3.0.0. Is it possible to do this with the thin drivers or do I need to use OCI? Is there any secret about JDBC and long raw, because no matter what I do I keep getting the ORA-00932 error? Any hint in the right direction would be greatly appreciated.

Thanks,
Chris O'Shea
Unisys Corporation
christophercoshea_at_unn.unisys.com

ERROR MESSAGE
c:\java>java JdbcTest
java.sql.SQLException: ORA-00932: inconsistent datatypes

  at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:184)  at
oracle.jdbc.ttc7.Oall7.receive(Oall7.java:631)	at
oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1206)  at
oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:649) 
at
oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:76 1) at
oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement.jav a: 803) at
oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:1145) at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.j av a:1178) at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedSt at ement.java:94) at JdbcTest.main(JdbcTest.java:41)

JAVA CODE
import java.sql.*;
import java.io.*;
import oracle.jdbc.*;

class JdbcTest
{
  public static void main (String args [])

       throws SQLException, ClassNotFoundException, FileNotFoundException, IOException
  {
// Load the Oracle JDBC driver

    Class.forName ("oracle.jdbc.driver.OracleDriver");

  // Connect to the database // You must put a database name after the @ sign in the connection URL. // You can use either the fully specified SQL*net syntax or a short cut // syntax as <host>:<port>:<sid>. The example uses the short cut syntax. Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@psfd.ea.unisys.com:1521:psfd", "userid", "passwd");

// Create a Statement

    int len;
    String insertStmt = "insert into oshea_test (emplid, ug_document) values (?,?)";

    String emplid = "020425";
    String filein = "test.doc";
    PreparedStatement stmt = conn.prepareStatement(insertStmt);     File mfile = new File(filein);
    len = (int) mfile.length();
    InputStream inputStream = new FileInputStream(mfile);

    stmt.setString(1, emplid);
    stmt.setBinaryStream(2, inputStream, len);     int rows = stmt.executeUpdate();
    System.out.println (rows);

  }
}

TABLE DESCRIPTION
SQL> desc oshea_Test

 Name                            Null?    Type
 ------------------------------- -------- ----
 EMPLID                                   VARCHAR2(11)
 UG_DOCUMENT                              LONG RAW

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Mon Feb 02 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US