Oracle.jdbc vs oracle.jdbc2

Hello World,
Whar is the differens between
oracle.jdbc
and
oracle.jdbc2
Where ca I read more about it?
Best regards
Anders Gunnare
Frontec

The weblogic driver is a type 2 (native) driver based upon the native OCI
Oracle client libraries. The Oracle thin driver is a type 4 (pure java)
driver. Type 2 drivers are typically faster but if you want to make a
performance based decision you should also include the type 2 driver(s)
available from Oracle in the comparison.
-Charlie
Mahesh wrote:
Hi,
We are curently using Oracle thin drivers for our
production servers. The Weblogic version is 5.1 SP9 and Oracle version is
8.1.6. Does anybody have any information about performance comparisons
between Weblogic's thin drivers and Oracle's ?
Thanx in advance
Mahesh

Similar Messages

  • BLOB insert behavior with thin driver using standard JDBC2.0 and ORACLE-JDBC2.0API

    We have a problem with a BLOB insert to an oracle 8.1.7 DB using Oracle 8.1.7 JDBC thin driver.We get socket read/write error after inserting 32k of data using the standard JDBC2.0 API but using the Oracle JDBC2.0API (using OracleResultSet) it goes fine. We have a requirement to use the standard JDBC2.0 so that our code works with multiple database vendors. Is there another way to get in the blob data with standard JDBC API & using thin driver...?
    thanks,
    Madhu
    Here is my sample test program that does both standard & oracle specific JDBC Blob test insert.
    import java.sql.*;
    import java.io.*;
    import oracle.sql.BLOB;
    import oracle.jdbc.driver.OracleResultSet;
    public class testBLOB {
    //trying to insert a huge file to a BLOB
    static String fileName = "/kernel/genunix";
    public static void main(String[] args) {
    String driverName = "oracle.jdbc.driver.OracleDriver";
    String dbURL = "jdbc:oracle:thin:@localhost:1521:test"; //thin driver
    String user = "BlobTest";
    String passwd = "BlobTest";
    Connection con=null;
    try {
    Class.forName(driverName);
    con=DriverManager.getConnection(dbURL, user,passwd);
    catch (Exception e) {
    e.printStackTrace();
    close(con);
    int i = 0;
    while (i < args.length) {
    if (args.equals("-f"))
    fileName = args[++i];
    i++;
    System.out.println("The file being Stored is: "+fileName);
    createTable(con);
    insertUsingOracleAPI(con);
    insertUsingJDBC20API(con);
    //readDB(con);
    static String getFileName() {
    return fileName;
    public static void close(Connection con) {
    try {
    if (con != null) {
    con.close();
    catch (Exception e) {
    System.exit(-1);
    public static void createTable(Connection con) {
    Statement stmt ;
    try {
    stmt = con.createStatement();
    stmt.execute("DROP TABLE basic_blob_table");
    stmt.close();
    catch (SQLException sqlEx) {
    System.out.println("Dropped the Table");
    try {
    stmt = con.createStatement();
    stmt.execute("CREATE TABLE basic_blob_table ( x varchar2(30), b blob)");
    stmt.close();
    catch (SQLException sqlEx) {
    sqlEx.printStackTrace();
    close(con);
    System.out.println("Created the Table");
    public static void insertUsingOracleAPI(Connection con) {
    OutputStream os = null;
    Statement stmt = null;
    ResultSet rs = null;
    FileInputStream is = null;
    try {
    con.setAutoCommit(false);
    stmt = con.createStatement();
    stmt.execute("INSERT INTO basic_blob_table VALUES( 'OracleAPI', empty_blob())");
    System.out.println("Inserted the dummy Row");
    rs = stmt.executeQuery("Select * from basic_blob_table where x='OracleAPI'");
    if (rs != null && rs.next()) {
    BLOB blob = ((OracleResultSet)rs).getBLOB(2);
    File file = new File(getFileName());
    is = new FileInputStream(file);
    os = blob.getBinaryOutputStream();
    byte[] chunk = new byte[1024];
    int length = -1;
    while((length = is.read(chunk)) != -1)
    os.write(chunk, 0,length);
    System.out.println("Inserted the File " + getFileName() );
    catch (Exception e) {
    e.printStackTrace();
    finally {
    try {
    if (os != null) {
    os.flush();
    os.close();
    if (is != null)
    is.close();
    stmt.close();
    con.commit();
    con.setAutoCommit(true);
    catch (Exception e) {}
    public static void insertUsingJDBC20API(Connection con) {
    PreparedStatement stmt = null;
    FileInputStream is = null;
    try {
    stmt = con.prepareStatement("INSERT INTO basic_blob_table VALUES(?,?)");
    File file = new File(getFileName());
    is = new FileInputStream(file);
    stmt.setString(1,"JDBC20API");
    stmt.setBinaryStream(2,is,(int)file.length());
    stmt.executeUpdate();
    catch (Exception e) {
    e.printStackTrace();
    finally {
    try {
    if (is != null)
    is.close();
    stmt.close();
    catch (Exception e) {}
    null

    Thanks for the response.
    I understand what you are saying...
    that readers don't block writers in Oracle (the same is true in SQL Server 2000).
    However, I don't see how my test case is working correctly with Oracle (the exact same code acting as I'm thinking it should with SQL Server, but I still think it is acting incorrectly with Oracle).
    I have transaction A do this:
    update <table> set <column2>=<value> where <column1>='1'
    then I use Thread.sleep() to make that program hang around for a few minutes.
    Meanwhile I sneak off and start another program which begins transaction B. I have transaction B do this:
    select * from <table> where <column1>='1'
    and the read works immediately (no blocking... just as you have said) however, transaction A is still sleeping, it has not called commit() or rollback() yet.
    So what if transaction A were to call rollback(), the value read by transaction B would be incorrect wouldn't it ?
    Both A and B use setAutoCommit(false) to start their transactions, and then call setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED).
    Isn't that supposed to guarantee that a reader can only read what is committed ?
    And if a row is in "flux"... in the process of having one or more values changed, then the database cannot say what the value will be ?
    I can almost see what you are saying.
    In letting the reader have what it wants without making it wait, I suppose it could be said that Oracle is holding true to the "only let committed data be read"
    So if that's it, then what if I want the blocking ?
    I want an entire row to be locked until whoever it in the middle of updating, adding, or removing it has finished.
    Do you know if that can be done with Oracle ? And how ?
    Thanks again for helping me.

  • Error with XSU: oracle.jdbc2.Clob

    When I try to insert data I get the following error.
    java.lang.NoClassDefFoundError: oracle.jdbc2.Clob
    void samp10.main(java.lang.String[])
    Exception in thread main.
    I use classes112.zip with Oracle 8.1.7.
    I have Included following libraries in JDeveloper: Oracle XML SQL Utility, Oracle XML Parser 2.0, JServer, Connection Manager and Oracle 8.1.6 JDBC.
    The sourcecode of my .java file is:
    /** Simple example on using Oracle XMLSQL API; this class inserts the data from a XML document into the database*/
    import oracle.xml.sql.dml.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.jdbc.*;
    import java.net.*;
    public class samp10
    //========================================
    // main() - public static void
    public static void main(String args[]) throws SQLException
    String tabName = "XMLTEST_TAB1"; // table into which to insert
    String fileName = "sampdoc.xml"; // file name containing the xml doc
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    //initiate a JDBC connection
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:SJEFEN",
    "scott","tiger");
    OracleXMLSave sav = new OracleXMLSave(conn, tabName);
    URL url = sav.createURL(fileName);
    int rowCount = sav.insertXML(url);
    System.out.println(" successfully inserted "+rowCount+
    " rows into "+ tabName);
    conn.close();
    The source code for the XML Document is:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW num="1">
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    </ROW>
    <ROW num="2">
    <EMPNO>7499</EMPNO>
    <ENAME>ALLEN</ENAME>
    <JOB>SALESMAN</JOB>
    </ROW>
    <ROW num="3">
    <EMPNO>7521</EMPNO>
    <ENAME>WARD</ENAME>
    <JOB>SALESMAN</JOB>
    </ROW>
    </ROWSET>
    I hope someone can help me!
    null

    This occurs when you mismatch the xsu jar file with the classes1x.zip file (the jdbc driver).
    xsu12.jar goes with classes12.zip
    xsu111.jar goes with classes111.zip

  • Where i can find oracle.jdbc2..... ?

    Hello,
    I reading a tutorial in oracle site and in a exemple it has it in import
    import java.sql.*;  // Ok
    import java.io.*; // Ok
    import oracle.sql.*; // Ok
    import oracle.jdbc.*; // Ok
    import oracle.oracore.*; // Error
    import oracle.jdbc2.*; // Error
    import java.math.*;
    // And a implementation
    // wich generate a error in SQLDATA
    public class Paymaster implements SQLDATA { I�ve downloaded the folow driver wich looks like the last oracle jdbc
    - Oracle9i Release 2 (9.2.0.3) & (9.2.0.1) drivers
    |- For use with JDK 1.4
    |- ojdbc14.jar - JDBC classes (1,181,679 bytes)
    But it doen�t have the jdbc2 too and the oracle.oracore and inside oracle.jdbc.oracore;
    Does anyone know where i can get that driver used in exemple??
    Here is the page
    If you wanna take a look in the example here is the page
    http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96659/03_pub.htm
    more or less 26 times page down
    Thank You.
    Jean

    you will find a jar file called classes111.jar in your ORACLE_HOME/jdbc/lib directory, oracle.jdbc2.* pacakge files will be present inside this jar. classes111.jar is to be used with JDK 1.1.x

  • Oracle.jdbc2.BatchUpdateException: ORA-00001:

    I am posting news with news post form
         when i create db tables and insert records then its working well
         but when I am droping the all table and importing db then it throws the
         subject error
    thanks & best regards

    Did you customize this workflow?
    For an item key that has failed, run $FND_TOP/sql/wfstatus.sql. Output the relevant portion of the output here.

  • Oracle.jdbc.driver.oracleResultSet Vs java.sql.ResultSet

    Hi all
    Could any one got any idea on this problem...
    My application program is forced to use both Java Result Set(java.sql.ResultSet) and Oracle ResultSet(jdbc.driver.oracleResultSet).
    This on javac get compiled and is working fine....
    But when i try to compile with vbjc(visibroker-java compiler)... it failes to compile...
    throwing ...
    .."The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return
    type."

    Hi Prowzen,
    Ur reply was much userful, which gave me a direction to prob into... Thank You Very MUCH.
    I relpaced
    BLOB blob = ((OracleResultSet)rs).getBLOB(int);
    with
    oracle.sql.BLOB blob =(BLOB)rs.getObject(int);
    So eliminating usage of OracleResultSet, the conflicts got cleared...
    Keep writing...
    Regards
    Sreekumar P P.
    [email protected]

  • JDBC 2/Oracle driver problems

    Hello,
    I am trying to use use JDBC 2 features on an oracle 8 database. I was told that this was possible as long as i used the correct driver (Oracle 8.1.6). I have downloaded this driver, added it to the projects library's, changed JDevelopers IDE Classpath to point to "classes12.zip".
    However when i try to set up a simple connection to the database i get errors, but when i switch back to the old oracle driver (8.1.5) it works ok). Below is the code that i use to connect to the DB:
    try
    DriverManager.setLogWriter(errorOut);
    DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection
    (url,"cdr","test");
    System.out.println("Coneecting to db using
    " + url);
    catch (Exception ex)
    The above code fails and produces the following errors/exceptions:
    DriverManager.initialize: jdbc.drivers = null
    JDBC DriverManager initialized
    registerDriver: driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@3779]
    registerDriver: driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@37b8]
    DriverManager.getConnection("jdbc racle:thin:@212.240.193.99:1521:inspect")
    trying driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@3779]
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: oracle/jdbc2/Blob
    void oracle.jdbc.dbaccess.DBAccess.setNlsParamsClient(oracle.jdbc.driver.OracleConnection)
    void oracle.jdbc.ttc7.TTC7Protocol.initNls(oracle.jdbc.driver.OracleConnection)
    void oracle.jdbc.driver.OracleConnection.<init>(oracle.jdbc.dbaccess.DBAccess, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)
    java.sql.Connection oracle.jdbc.driver.OracleDriver.getConnectionInstance(oracle.jdbc.dbaccess.DBAccess, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)
    java.sql.Connection oracle.jdbc.driver.OracleDriver.connect(java.lang.String, java.util.Properties)
    java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties, java.lang.ClassLoader)
    java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String)
    null

    Hi,
    Sorry, I didn't look closely enough at your error stack. The problem appears to be with the Blob class. This class has moved from classes12.zip.
    In the Oracle JDBC Developer's Guide and Reference docs (8.1.6), there is a section on upgrading from JDK 1.1.x to JDK 1.2:
    Migration from JDK 1.1.x to JDK 1.2.x
    The only migration requirements in going from JDK 1.1.x to JDK 1.2.x are as follows:
    Remove your imports of the oracle.jdbc2 package, as discussed above under "Datatype Support".
    Replace any direct references to oracle.jdbc2.* interfaces with references to the standard java.sql.* interfaces.
    Type map objects (for mapping SQL structured objects to Java types), which must extend the java.util.Dictionary class under JDK 1.1.x, must
    implement the java.util.Map interface under JDK 1.2.x. Note, however, that the class java.util.Hashtable satisfies either requirement. If you used
    Hashtable objects for your type maps under JDK 1.1.x, then no change is necessary. For more information, see "Creating a Type Map Object and Defining
    Mappings for a SQLData Implementation".
    If these points do not apply to your code, then you do not need to make any code changes or recompile to run under JDK 1.2.x.

  • Passing collection parameters from/to Oracle 8i stored procedure to/from Weblogic java program

    Environment- Oracle DB 8.1.7 (Sun) - JDBC OCI 8.1.7 - Application Server (WebLogic 6.0 or 6.1)QuestionHow to pass oracle collection data types from PL/SQL stored procedures to Weblogic java program as in/out stored procedures parameters. I am hitting oracle error 2006 unidentified data type trying to pass the following data types:-o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatumInformationAbout PL/SQL stored procedure limitation which only affects the out argument types of stored procedures calledusing Java on the client side. Whether Java methods cannot have IN arguments of Oracle 8 object or collection type meaning that Java methods used to implement stored procedures cannot have arguments of the following types:o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatum

    this is becoming a mejor problem for me.And are you storing it as a blob?
    Oracle doesn't take varchars that big.
    And isn't LONG a deprecated field type for Oracle?
    From the Oracle docs......
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/sql_elements001.htm#sthref164
    Oracle strongly recommends that you convert LONG RAW columns to binary LOB (BLOB) columns. LOB columns are subject to far fewer restrictions than LONG columns. See TO_LOB for more information.

  • Oracle 8.1.5 EE- interMedia 8.1.5 Compilations Errors

    Greetings,
    Im runnin` Oracle 8.1.5 EE, with interMedia 8.1.5 in a windowsNT|2000 Environment and my PATH and CLASSPATH are correctly setup... Running Jakarta Tomcat as the JSP/Servlet Engine as well as JDK 1.2
    ======= Do I need anything else ?? =======
    During compilation I keep running into similar errors like the following (12 of them):
    OrdSampleAlbumBean.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.
    import java.io.*;
    ^
    OrdSampleAlbumBean.java:0: The method oracle.jdbc2.Clob getClob(java.lang.String) declared in class oracle.jdbc.driver.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.
    import java.io.*;
    ^
    OrdSampleAlbumBean.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.
    import java.io.*;
    ^
    The errors seem to be steming from the imports which are:
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.ServletException;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.ord.im.OrdImage;
    import oracle.ord.im.OrdHttpUploadFile;
    Like I said, all the classes and libraries ARE in fact in my path and classpath variables. And interMedia is setup Correctly in Oracle according to imchk.sql
    Any help in this matter would be greatly appreciated. Thanks in Advance.

    Hi Ramene,
    Lets look at a couple of approaches.
    The interMedia Web Agent is a web server plugin that supports the Oracle iAS, Apache, iPlanet, Microsoft IIS and Oracle OAS web/application servers on Solaris, NT and Linux (though not all web servers on all platforms, for obvious reasons!). It uses OCI to call PL/SQL procedures that return BLOBs which the Web Agent uses to upload and retrieve multimedia data. On the plus side, it is supported on Oracle 8.1.5. On the minus side, a Java application written using the interMedia Web Agent is not going to be as tightly integrated as an all-Java solution. I don't know if it would be of any use in your particular application environment, but you may also want to look at the interMedia Clipboard. It is a light-weight WinNT application that uses the Web Agent to upload and retrieve multimedia data in an Oracle 8i database. You can find examples of applications that use the Web Agent on OTN. Check out the "Dynamic Web applications using interMedia Web Agent" and "Load rich media content with a browser" links under the interMedia Sample Code tab on OTN.
    Looking at an all-Java solution, with your Oracle 8.1.5 and JDK 1.2 configuration, I'm afraid you're always going to be stuck with the incompatiblites between the BLOB support in the Oracle 8.1.5 JDBC 1.1 driver implementation and the JDBC 1.2 interfaces. Again, please let me stress (to anyone reading this note) that this is not because of a problem of with the Oracle 8.1.5 JDBC 1.1 driver - it added support for BLOBs in a version of JDBC that didn't support BLOBs at all. The Oracle 8.1.6 release includes a JDBC 1.2 compliant driver that supports BLOBs according to the JDBC spec.
    However, here's a thought, though I don't know if it would be officially supported (I'm not saying it wouldn't be, I just don't know if it is). Mind you, I don't believe the JDK 1.2/1.3 plus Oracle 8.1.5 EE configuration is officially support for that matter. I don't know if its possible for you to do this, but upgrade another system to Oracle 8.1.6. Then take the JDBC 1.2 driver (classes12.zip) and the SQLK/JPub runtime (runtime.zip) from the 8.1.6 installation and copy them somewhere on the 8.1.5 system. Include these files at the beginning of the CLASSPATH and use the 8.1.6 thin JDBC driver to connect to the 8.1.5 database. (The thick driver is unlikely to work as it requires an 8.1.6 version of OCI.) If this does work for you (it works on my systems), then at least you'll have something going, although it won't perform as well as the thick driver.
    Re: "I need to support Oracle 8.0.5". I hope this was a typo and you don't really need to support 8.0.5. Of course, 8.0.5 does have BLOBs, but I'm not sure how robust the Java support for BLOBs was back then - that was quite a long time ago (at least it seems that way for someone working on 9i).
    I guess the bottom line here is to upgrade to 8.1.6 as soon as possible to get full JDK 1.2 support. In the meantime, I Hope this helps,
    Simon
    null

  • Jdk 1.2 clients running ejb deployed on oracle 8.1.5

    Oracle claims that it is possible to run jdk 1.2 clients with ejb on oracle 8.1.5 in the faq : http://technet.oracle.com/products/oracle8i/htdocs/jserver_faq/815faq0012.html
    If you have JDK1.2 on the client side and:
    8.1.5 clients connecting to an 8.1.5 server: This does not work, because of conflicts with the ORB supplied in JDK1.2.
    8.1.5 clients connecting to an 8.1.6 server: This does not work, because of conflicts with the ORB supplied in JDK1.2.
    8.1.6 clients connecting to an 8.1.5 server: This works provided the "server" portion of the application is developed/loaded using the client side tools and jars that are supplied with 8.1.5.
    What do they meen with 8.1.6 clients? and how to make 8.1.6 clients?

    Oracle 8.1.6's JVM uses JDK 1.2. Oracle's 8.1.6 JDBC drivers support JDBC2 and JDK2. The 8.1.6 drivers are available for download from OTN under the Technologies section.
    If you develop a client (application, applet, servlet, JSP, etc.) using the Oracle 8.1.6 JDBC drivers, then this is considered an Oracle 8.1.6 client.
    Laura

  • Oracle 9i +Java: Change string encoding from UTF-16 to Windows-1251

    Dear colleagues,
    I have a very urgent case: need to change encoding of the string retrieved from the file (with encoding UTF-16) to Windows-1251 and put it to db table, to CLOB field.
    Code of the Java function
    +public static void file2table(String sql, String fileName, String characterSet, int asByteArray) throws SQLException, IOException {+
    Connection con = null;
    Writer writer = null;
    Reader reader = null;
    +try {+
    con = getConnection();
    PreparedStatement ps=con.prepareStatement(sql);
    reader = new InputStreamReader(new BufferedInputStream(new FileInputStream(new File(fileName))), characterSet);
    BufferedReader br = new BufferedReader(reader);
    String s;
    +while ((s = br.readLine()) != null) {+
    byte[] defaultBytes=s.getBytes(characterSet);
    String win1251str=new String(defaultBytes, "windows-1251");
    +if(asByteArray>0) {+
    ps.setBytes(1, defaultBytes);
    +//ps.setBytes(1, win1251str.getBytes("windows-1251"));+
    +} else {+
    ps.setString(1, s);
    +}+
    ps.executeUpdate();
    +}+
    con.commit();
    +} finally {+
    +if (reader != null) {reader.close();}+
    +if (con != null) {con.close();}+
    +}+
    +}+
    I was check, all bytes from the file received correctly. But if I put readed bytes to database table, result text in table is broken.

    >
    Yes, currently I already have filled table with all file lines in result table but with incorrect encoding
    >
    No you haven't - not using the code you posted. You can't save LOB data using only the BLOB or CLOB.
    That isn't data that you strored - it is garbage that is being stored as the LOB locator.
    I ask you why you were trying to store the data that way instead of the way the doc shows you and you said
    >
    Because var. s is type of Java String.
    For method setClob must be use type of CLOB
    >
    You are teriibly confused about LOBs. A BLOB or CLOB Java datatype is the LOB LOCATOR and doesn't contain any data.
    Yes - it is true that method setClob must be of type CLOB but that CLOB instance HAS TO BE THE LOB LOCATOR - not the data.
    You access LOB data using streams. To store LOB data you have to RETRIEVE (not send) a LOB locator from the database and then use the locator's stream to send the actual data.
    So if you are creating a new record in the table you typically do an INSERT that includes an EMPTY_LOB() and have the newly created LOB locator returned to you. Then you use that locators stream to send the actual data.
    Since you are not doing that your approach will not work.
    Here is a link to the 9i JDBC Dev Guide
    http://docs.oracle.com/cd/B10501_01/java.920/a96654.pdf
    See page 8-2 to start with
    >
    BLOB and CLOB data is
    accessed and referenced by using a locator, which is stored in the database table and
    points to the BLOB or CLOB data, which is outside the table.
    To work with LOB data, you must first obtain a LOB locator. Then you can read or
    write LOB data and perform data manipulation. The following sections also
    describe how to create and populate a LOB column in a table.
    The oracle.sql.BLOB and CLOB classes implement the java.sql.Blob and
    Clob interfaces, respectively (oracle.jdbc2.Blob and Clob interfaces under
    JDK 1.1.x). By contrast, BFILE is an Oracle extension, without a corresponding
    java.sql (or oracle.jdbc2) interface.
    Instances of these classes contain only the locators for these datatypes, not the data.
    After accessing the locators, you must perform some additional steps to access the
    data. These steps are described in "Reading and Writing BLOB and CLOB Data" on
    page 8-6 and "Reading BFILE Data" on page 8-22.
    Note: You cannot construct BLOB, CLOB, or BFILE objects in your
    JDBC application—you can only retrieve existing BLOBs, CLOBs,
    or BFILEs from the database or create them using the
    createTemporary() and empty_lob() methods.
    >
    Read the above quotes several times until you understand what they are telling you. These are the two main concepts you need to accept:
    >
    To work with LOB data, you must first obtain a LOB locator.
    You cannot construct BLOB, CLOB, or BFILE objects in your JDBC application
    >
    See the example code and description starting on page 8-11 for how to populate a LOB column in a table
    >
    Create a BLOB or CLOB column in a table with the SQL CREATE TABLE statement,
    then populate the LOB. This includes creating the LOB entry in the table, obtaining
    the LOB locator, creating a file handler for the data (if you are reading the data from
    a file), and then copying the data into the LOB.
    >
    Until you start using the proper methodology you are just wasting you time and will not be successful.

  • Oracle BLOB problem...pls help if possible

    I have been having trouble with my JSP code using the Tomcat server. I've finally gotten the compiler to recognize my result set as an Oracle Result set without it giving me casting errors. Here is part of my code:
    %@ page import="oracle.sql.*"%>
    <%@ page import="oracle.sql.BLOB"%>
    <%@ page import="oracle.jdbc.driver.*"%>
    <%@ page import="oracle.jdbc.driver.OracleResultSet"%>
    <%@ page import="java.lang.Object.*"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="java.io.*"%>
    <body bgcolor="navajowhite">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:Andy","system","pass");
    //con.setAutoCommit(false);
    Statement myStatement = null;
    String sourceDirectory = "D:\\Tomcat\\jakarta-tomcat-4.0.3\\webapps\\Root\\Mproject\\";
    String fileName = sourceDirectory + "Test.doc";
    String SS = "222-22-2222";
    myStatement.executeUpdate("INSERT INTO LI.TEST (ID, FILE_NAME, BLOB_COLUMN)" +
    "VALUES(SS,'" + fileName + "',EMPTY_BLOB())");
    oracle.jdbc.driver.OracleResultSet blobResultSet =
    (oracle.jdbc.driver.OracleResultSet)myStatement.executeQuery(
                   "select BLOB_COLUMN " +
                   "from LI.TEST "+
                   "where FILE_NAME = '" + fileName + "' " +
                   "FOR UPDATE" );
    blobResultSet.next();
    oracle.sql.BLOB myBlob;
    myBlob = ((oracle.jdbc.driver.OracleResultSet)blobResultSet).getBLOB("BLOB_COLUMN");
         int chunkSize = myBlob.getChunkSize();
         byte[] byteBuffer = new byte[chunkSize];
         File myFile = new File(fileName);
         FileInputStream myFileInputStream = new FileInputStream(myFile);
         long position = 1;
         int bytesRead;
         while ((bytesRead = myFileInputStream.read(byteBuffer)) != -1)
              myBlob.putBytes(position, byteBuffer);
              position += bytesRead;
         myFileInputStream.close();
    however now, it is still giving me wierd errors. It says that
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Clob getClob(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Clob getClob(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Ref getRef(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Ref getRef(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Blob getBlob(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Array getArray(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    D:\Tomcat\jakarta-tomcat-4.0.3\work\localhost\_\Mproject\blobtest5$jsp.java:0: The method oracle.jdbc2.Array getArray(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return type.     
    package org.apache.jsp;
    ^
    8 errors, 1 warning
    can anybody tell me what i'm doing wrong? This is the last hurdle in my project and I would sincerly apprecaite any help. Many thanks
    Andrew

    OK, I'm confused. You declare a statement, set it to null, then try to execute a query with it? Your statement will still be null, you'll get a NullPointerException.
    And the OracleResultSet? This object will ONLY be created by using either Oracle's thin driver or OCI driver. The JDBC-ODBC bridge has no idea what an OracleResultSet is. The OracleResultSet IS a ResultSet object so there is no marked error on the cast, but the fit just isn't there. Had this compiled you could expect a ClassCastException at runtime.
    If you have to use ODBC, you will not be able to use Oracle-specific database objects. If you have an Oracle database available, then the ODBC driver is going to give you poor performance anyway, use Oracle's thin driver and you'll have access to the objects you're attempting to manipulate.
    And, as always, have fun!

  • With JDBC, calling a stored procedure with ARRAY as out parameter

    Hi,
    I want to use the data type ARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
    my java program using JDBC.
    The problem it's i use a 8.1.7 client to acces with oci to a 7.1.3 Database.
    With this configuration I can get back a Cursor but not an Array.
    Does it's possible ?
    Thanks for your help !
    Michakl

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • Calling a stored procedure with VARRAY as out parameter using JDBC

    Hi,
    I want to use the data type VARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
    my java program using JDBC.
    I'm using Oracle 8.1.5 for Windows NT.
    Please help me.
    Thanks
    Sumanta
    null

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • JDBC for use with jdk1.4

    Is the download file:JDBC for use with jdk1.4 in oracle website contains oracle jdbc2.0 ??

    Is the download file:JDBC for use with jdk1.4 in oracle website contains oracle jdbc2.0 ?? the JDK 1.4.x related jars/zips @ http://otn.oracle.com/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
    contain the complete JDBC 2.0 features as well as some JDBC 3.0 features supported as of this JDBC release
    For more details, see 9i DB R2 features overview http://otn.oracle.com/tech/java/htdocs/9idb2_java.html
    Kuassi

Maybe you are looking for

  • Data appearing in VI Logger task not showing up in database but exists on disk

    Using VI logger lite 2, we ran a task that upon completion, appeared in the data selection subtree of the task much like successful data runs.  However, when one clicks on that data string, an error message stating that the task run selected cannot b

  • Deletion of record from z table

    Hi, How can I delete or update a record directly from Z table. Are there any implications in deleting the record directly. Thanks, Waqas Rashid

  • Chart issue

    Hi Friends, For my requirement, i need to draw one curve in the column chart.In the chart i am having one characterstic and one keyfigure. Can anybody explain how to achieve this. Regards Madhu

  • Macbook Pro not turning off after spillage.

    Hi Yesterday night I was doing something on my laptop, and a bit of yougurt got spilled on the keyboard part. I wiped the yogurt off the keyboard very quickly, I left it upside down and went to sleep. Now I've come back home , and I have tried to tur

  • Can i use the buttons in JOptionPAne instead of default

    sir i want to change means insert icon on the the ok and cancel buuton instaed of JOptionPane buuttons can i do and how? thanks