Results 1 to 2 of 2

Thread: ORA-01460 error

  1. #1
    Join Date
    Jan 2009
    Posts
    10
    Rep Power
    0

    Smile ORA-01460 error

    This application illustrates how to upload an image using servlet,

    package myIamge;

    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    public class ImageInsertInTable extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException{
    PrintWriter pw = response.getWriter();
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin: @localhost:1521:XE","system","sivakumar");
    System.out.println("Connection established");
    PreparedStatement ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file =new File("E:/SIVA/kumar.jpg"); //image size is 126 kb
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,8);
    ps.setBinaryStream(2,fs,fs.available());
    int i = ps.executeUpdate();
    if(i!=0){
    pw.println("image inserted successfully");
    }
    else{
    pw.println("problem in image insertion");
    }
    }
    catch (Exception e){
    System.out.println(e);
    }
    }
    }

    when i am running this program i got exception like..
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested

    thanks....

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    not strictly a servlets question,

    the stream methods on (prepared) statements are new as of JDBC 4 (i.e. Java 1.6)
    If your JDBC driver is up to date and does support the use of these, it is highly possible the database connection pool code (i.e. commons-pool from jakarta, or the pool variant found in tomcat) - is not yet caught up to this. as of today, their current release still only supports JDBC3 functionality.

    This hooped me for a while, in my case I was trying to use H2 database which on its own, direct connection, it worked, but wouldn't work when i used a commons-pool JDBC connection pool.

    but, no, I see now you aren't even using that, just doing direct JDBC driver fetching the connection thing from the driver manager.

    Ok, so its is likely the OracleXE JDBC driver you happen to be using is not JDBC4 implemented, or you are running on not java 1.6 ?

    Oracle JDBC FAQ sais JDBC4 is fully supported in Oracle 11.1.0 and 11.2.0. I wonder if their XE is not in that family, or the version of XE you have is before this? Maybe try to fetch the JDBC driver from the oracle release 11.1 and try to use that instead of the one that came with your XE ?

    Also, before Oracle 10.1 you used to have to go to the trouble of using their OCI mode connection, not the thin mode as you are here for working with BLOB types. I think this is no longer the case, but if you believe your jdbc driver should support JDBC4, then maybe try to use the OCI mode?
    Last edited by travishein; 09-27-2009 at 03:31 AM.

Similar Threads

  1. Replies: 3
    Last Post: 01-23-2009, 08:53 AM
  2. error 530 error authentication required
    By rgale in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-12-2008, 04:28 PM

Posting Permissions

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