Error while inserting into blob column through PL/SQL

Hi All,
I am trying to insert into column having blob as datatype.
INSERT INTO imagedb(image_name, content,description) VALUES ('logo.png',
?{file 'c:\logo.png'}, 'logo');
it gives me error Unknown JDBC escape sequence:
Is there anything wrong in above insert syntax for inserting into BLOB data type.
Can any body please help me.
Regards,
Hiren

It is not valid SQL as far as Oracle SQL is concerned. I assume that the file construct is suppose to replace that with the contents of the file?
What happens when the file size exceeds the max length of the SQL command?
And do you have any idea what will happen to the SQL Shared Pool on Oracle that needs to store the entire SQL command for every single SQL command passed to it? The whole purpose of the Shared Pool is for storing shared SQL. Not non-sharable SQL containing hardcoded values.
Bind variable are to be used.. if you expect Oracle to perform like only Oracle can.
And my bet is that you have not even bothered to read [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/toc.htm]Oracle® Database Application Developer's Guide - Large Objects guide....

Similar Messages

  • Error while inserting into MS-SQL Server from Oracle using HS

    Hi,
    I am using hetrogeneous connection.
    I want to insert into MS-SQL Server Table by selecting from Oracle Tables.
    insert into tableone@mssql select * from table2;
    Table2 is in oracle database.
    while executing i'm getting
    ORA-02025: all tables in the SQL statement must be at the remote database
    Please guide me.
    Regards
    Salih KM

    some guy come up a solution by himself before. go ahead and try it
    ORA-02025 error while insert into emp@custard select ....

  • Error while inserting into ms access using jsp

    i am using the following code to insert values from textboxes into access database
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(url);
              Statement stmt=con.createStatement();
              //ResultSet rs = null;
              //String sql = ("INSERT INTO co-ords VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ");
              String sql = "INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ";
              out.println(sql);
              stmt.executeUpdate(sql);
    the output i get is
    INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('cck','28.656529681148545','77.23440170288086','28','77','39','14','23.508','3.8472') Exception:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    can somebody help me?

    Simple,
    Some error in your query right. Unable to understand Quotation stuff.
    Well understand it properly else error will follow forever :)
    Without String, Straight Away Values
    stmt1.executeUpdate("insert into Login_Details values('Example','Exmaple')");This is the query with Login_Id Pass_Word String containing the value
    stmt1.executeUpdate("insert into Login_Details values('"+Login_Id+"','"+Pass_Word+"')");Then storing sql as string and pass it in executeUpdate(sql)
    String sql="insert into Login_Details values ('example','example') "String + Values in String
    String sql="insert into Login_Details values ('"+example+"','"+example+"') "Just first it . Hope this reply solve ur SQL EXCEPTIONG
    Sachin Kokcha

  • Error while insert into database using DB adpater for Field BLOB

    Hello All
    I am trying to tranfer data from Database A to Database B using Oracle DB adapter.
    Table of databse A contains field BLOB, which cotains the resume /doc file.After transformation in Database B format ,while invoking the DB adapter to insert, I am getting follwing error
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="code"><code>null</code>
    </part><part name="summary"><summary>file:/u01/bpelvinc/product/10.1.3.1/OracleAS_1/bpel/domains/viapps/tmp/.bpel_ERecuit_Application_New_1.0_d1c2b2149a9e0c7c745279667ad1fc84.tmp/DB_APPL_111.wsdl [ DB_APPL_111_ptt::insert(RtmApplicantCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [DBAPPL111.RtmApplicant]. [Caused by: Error in encoded stream, got 2]
    ; nested exception is:
         ORABPEL-11616
    DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [DBAPPL111.RtmApplicant]. [Caused by: Error in encoded stream, got 2]
    Caused by Exception [TOPLINK-3001] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [xs:base64Binary 43524541544520544193B0D0A], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp].
    Internal Exception: java.io.IOException: Error in encoded stream, got 2.
    </summary>
    </part><part name="detail"><detail>
    Exception Description: The object [xs:base64Binary 4352E616D65293B0D0A], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp].
    Internal Exception: java.io.IOException: Error in encoded stream, got 2</detail>
    </part></bindingFault>
    Please let me know ,what are the possibilities.
    Thanks
    Satendra

    Hi...
    well... My flow goes like Pl/SQl ---> BPEL,
    Now PL/SQL code reads data from the Database A and Send it to BPEL which inserts into the Database B.
    with respest to above design, I found the problem in pl/sql block.
    Actually I am sending a BLOB field in the soap message. but some how pl/sql now ablt tot handle that or sending some wrong data.
    my question is how to send a blob filed data to bpel using pl/sql block. this the reasion I am getting above error.
    Thanks

  • ORA-01438 error while inserting the BLOB value in the column

    Hi All,
    I have created a table with definition:
    CREATE TABLE stories (id NUMBER(4), story BLOB);
    Now I am trying to populate this table with some values from other table with:
    insert into stories
    select sensitivity_id, multi_value from sensitivity where sensitivity_id=3983021541;
    Here the multi_value column from th source table is also declared as BLOB so I shlould not get this error. What kind of precision needs to be set so the query doesnt faills?
    Regards,
    aashish

    Hi,
    Can you elaorate more on this..I never tried his thing but this is just a part of big procedure where I have to do this.
    Thanks,
    aashish

  • Insert into blob column from form6i

    Dear all,
    I have a question....
    I need to develop an application with form6i which gets the filename and path from user and inserts the content of the file in a table with blob column...
    the files may be in any format...How can I do it in oracle form 6i..our database is 10g...
    If anybody has a sample please send me :[email protected]
    ThanX
    Farnaz

    If you want to insert a string and next convert to BLOB, you use the next SQL
    PreparedStatement ps = connectionObject.prepareStatement("INSERT INTO TEST_BLOB(NO,STR) VALUES(?,TO_BLOB(?))");and next
    ps.setInt(1, "1");
    ps.setString(2,"sample string here");

  • ORA-02025 error while insert into emp@custard select ....

    Hello All,
    I want to insert the row in MS Access 2003 database from SQL PLUS. My oracle version is 9.2.0.1. and OS is Windows 2000 server.
    Insert command is:
    SQL> insert into emp@custard select empno, ename, job, mgr, hiredate, sal, comm, deptno from emp ;
    and the error is
    ORA-02025: all tables in the SQL statement must be at the remote database.
    Thanks for helping me.
    Akshay.
    PS: i am able to see the records of Access table in SQL Plus using below command
    select * from acc_tab@custard ;

    Hi,
    I got the solution.
    You can not use directly Insert into remote_table select * from local_table while the other database is not oracle database. The same can be done as:
    SQL> select * from emp@custard ;
    no rows selected
    SQL> copy from scott/tiger@trimcap insert emp@custard using select * from emp ;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    14 rows selected from scott@trimcap.
    14 rows inserted into EMP@CUSTARD.
    14 rows committed into EMP@CUSTARD at DEFAULT HOST connection.
    SQL> select * from emp@custard ;
    EMPNO ENAME JOB MGR HIREDATE SAL COMM
    DEPTNO
    7369 SMITH CLERK 7902 17/DEC/80 800
    20
    7499 ALLEN SALESMAN 7698 20/FEB/81 1600 300
    30
    7521 WARD SALESMAN 7698 22/FEB/81 1250 500
    30
    EMPNO ENAME JOB MGR HIREDATE SAL COMM
    DEPTNO
    7566 JONES MANAGER 7839 02/APR/81 2975
    20
    7654 MARTIN SALESMAN 7698 28/SEP/81 1250 1400
    30
    7698 BLAKE MANAGER 7839 01/MAY/81 2850
    30
    EMPNO ENAME JOB MGR HIREDATE SAL COMM
    DEPTNO
    7782 CLARK MANAGER 7839 09/JUN/81 2450
    10
    7788 SCOTT ANALYST 7566 19/APR/87 3000
    20
    7839 KING PRESIDENT 17/NOV/81 5000
    10
    EMPNO ENAME JOB MGR HIREDATE SAL COMM
    DEPTNO
    7844 TURNER SALESMAN 7698 08/SEP/81 1500 0
    30
    7876 ADAMS CLERK 7788 23/MAY/87 1100
    20
    7900 JAMES CLERK 7698 03/DEC/81 950
    30
    EMPNO ENAME JOB MGR HIREDATE SAL COMM
    DEPTNO
    7902 FORD ANALYST 7566 03/DEC/81 3000
    20
    7934 MILLER CLERK 7782 23/JAN/82 1300
    10
    14 rows selected.
    SQL>
    Hope this helps others... if you stuck like me.
    Thanks & Regards,
    Akshay Brahmbhatt.

  • Error while inserting into secure store when installing solution manager

    hi all,
    I have problem when the installation of solution manager try to insert into secure store,
    the installation completed creating the secure store, but at the inserting the error raised...
    i need your helps,
    Thanks in advanced

    thi is the insallation log:Import Monitor jobs: running 0, waiting 0, completed 30, failed 0, total 30.
    INFO 2010-12-29 15:06:23.972
    Execute step extractMigrationCheckerArchive of component |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|2|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0|NW_ABAP_Import_Dialog|ind|ind|ind|ind|5|0|NW_ABAP_Import|ind|ind|ind|ind|0|0
    INFO 2010-12-29 15:06:25.315
    Execute step runPackageChecker of component |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|2|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0|NW_ABAP_Import_Dialog|ind|ind|ind|ind|5|0|NW_ABAP_Import|ind|ind|ind|ind|0|0
    INFO 2010-12-29 15:06:25.378
    Switched to user: s01adm.
    INFO 2010-12-29 15:06:25.409
    Creating file C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS\package_checker.java.log.
    INFO 2010-12-29 15:06:25.409
    Switched to user: s01adm.
    INFO 2010-12-29 15:06:25.425
    Working directory changed to C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS.
    INFO 2010-12-29 15:06:25.425
    Output of C:\j2sdk1.4.2_29-x64\bin\java.exe -classpath migcheck.jar -showversion com.sap.inst.migcheck.MigrationChecker -checkPackages -installDir "C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS" -packageFile "W:\soman cd instation export2-442\DATA_UNITS\EXP4\DATA\SAPSTR.LST" -trace all is written to the logfile package_checker.java.log.
    INFO 2010-12-29 15:06:25.675
    Execution of the command "C:\j2sdk1.4.2_29-x64\bin\java.exe -classpath migcheck.jar -showversion com.sap.inst.migcheck.MigrationChecker -checkPackages -installDir "C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS" -packageFile "W:\soman cd instation export2-442\DATA_UNITS\EXP4\DATA\SAPSTR.LST" -trace all" finished with return code 0. Output:
    java version "1.4.2_29"
    Java(TM) Platform, Standard Edition for Business (build 1.4.2_29-b01)
    Java HotSpot(TM) 64-Bit Server VM (build 1.4.2_29-b01, mixed mode)
    INFO 2010-12-29 15:06:26.269
    Execute step runObjectChecker of component |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|2|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0|NW_ABAP_Import_Dialog|ind|ind|ind|ind|5|0|NW_ABAP_Import|ind|ind|ind|ind|0|0
    INFO 2010-12-29 15:06:26.331
    Switched to user: s01adm.
    INFO 2010-12-29 15:06:26.362
    Creating file C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS\object_checker.java.log.
    INFO 2010-12-29 15:06:26.378
    Switched to user: s01adm.
    INFO 2010-12-29 15:06:26.378
    Working directory changed to C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS.
    INFO 2010-12-29 15:06:26.378
    Output of C:\j2sdk1.4.2_29-x64\bin\java.exe -classpath migcheck.jar -showversion com.sap.inst.migcheck.MigrationChecker -checkObjects -dbType ORA -tskDir "C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS" -strDirs "W:\soman cd instation export1-442\DATA_UNITS\EXP1\DATA;W:\soman cd instation export1-442\DATA_UNITS\EXP2\DATA;W:\soman cd instation export2-442\DATA_UNITS\EXP3\DATA;W:\soman cd instation export2-442\DATA_UNITS\EXP4\DATA" -trace all is written to the logfile object_checker.java.log.
    INFO 2010-12-29 15:06:28.878
    Execution of the command "C:\j2sdk1.4.2_29-x64\bin\java.exe -classpath migcheck.jar -showversion com.sap.inst.migcheck.MigrationChecker -checkObjects -dbType ORA -tskDir "C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS" -strDirs "W:\soman cd instation export1-442\DATA_UNITS\EXP1\DATA;W:\soman cd instation export1-442\DATA_UNITS\EXP2\DATA;W:\soman cd instation export2-442\DATA_UNITS\EXP3\DATA;W:\soman cd instation export2-442\DATA_UNITS\EXP4\DATA" -trace all" finished with return code 0. Output:
    java version "1.4.2_29"
    Java(TM) Platform, Standard Edition for Business (build 1.4.2_29-b01)
    Java HotSpot(TM) 64-Bit Server VM (build 1.4.2_29-b01, mixed mode)
    INFO 2010-12-29 15:06:29.487
    Execute step unpackJ2EEINSTALL of component |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|2|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0
    INFO 2010-12-29 15:06:30.347
    Execute step createSecureStore of component |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|2|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0|NW_SecureStore|ind|ind|ind|ind|8|0
    INFO 2010-12-29 15:06:30.847
    Switched to user: s01adm.
    INFO 2010-12-29 15:06:30.878
    Creating file C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS\SecureStoreCreate.log.
    INFO 2010-12-29 15:06:30.878
    Switched to user: s01adm.
    INFO 2010-12-29 15:06:30.878
    Working directory changed to C:\Program Files\sapinst_instdir\SOLMAN\SYSTEM\ORA\CENTRAL\AS.
    INFO 2010-12-29 15:06:30.878
    Output of C:\j2sdk1.4.2_29-x64\bin\java.exe -classpath "C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/launcher.jar" -Xmx256m com.sap.engine.offline.OfflineToolStart com.sap.security.core.server.secstorefs.SecStoreFS "C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/lib/iaik_jce.jar;C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/exception.jar;C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/logging.jar;C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/tc_sec_secstorefs.jar" create -s S01 -f
    sapdev/sapmnt/S01/SYS/global/security/data/SecStore.properties -k
    sapdev/sapmnt/S01/SYS/global/security/data/SecStore.key -enc -p XXXXXX is written to the logfile SecureStoreCreate.log.
    INFO 2010-12-29 15:06:31.628
    Execution of the command "C:\j2sdk1.4.2_29-x64\bin\java.exe -classpath "C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/launcher.jar" -Xmx256m com.sap.engine.offline.OfflineToolStart com.sap.security.core.server.secstorefs.SecStoreFS "C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/lib/iaik_jce.jar;C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/exception.jar;C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/logging.jar;C:/Program Files/sapinst_instdir/SOLMAN/SYSTEM/ORA/CENTRAL/AS/install/sharedlib/tc_sec_secstorefs.jar" create -s S01 -f
    sapdev/sapmnt/S01/SYS/global/security/data/SecStore.properties -k
    sapdev/sapmnt/S01/SYS/global/security/data/SecStore.key -enc -p XXXXXX" finished with return code 0. Output:
    SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    Store with encryption and a key phrase created.
    WARNING[E] 2010-12-29 15:06:31.738
    CJS-30226  Host: 'sapdev' or port: 'undefined' or dbSid: 'D01' is in an inconsistent state or undefined.
    ERROR 2010-12-29 15:06:31.753
    FCO-00011  The step createSecureStore with step key |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|2|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0|NW_SecureStore|ind|ind|ind|ind|8|0|createSecureStore was executed with status ERROR .
    and this is the secureStoreCreate.log:
    SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    Store with encryption and a key phrase created.
    and this is the stepLogMessages.xml:
    <message type="warning" timestamp="2010-12-29 15:10:53.982">Host: 'sapdev' or port: 'undefined' or dbSid: 'D01' is in an inconsistent state or undefined.</message>
      <message type="trace" timestamp="2010-12-29 15:10:53.982">JS Callback has thrown unknown exception. Rethrowing.</message>
      </messageStack>
      </stepMessages>
    thanks for your fast response

  • 'FROM keyword not found where expected'error while Inserting into Text file

    Hi,
    I have created a simple interface for testing purpose. All it has to do is to Read the data from a Source Text file and put it into another text file (exactly the same headers as that of source) ...
    I am using Oracle as my staging area.
    But at 'Insert column Header' Stage, it gives me a warning 'FROM keyword not found where expected' and when it goes to the next step 'Insert Rows' it gives me the same error 'FROM keyword not found where expected' and aborts its execution.
    I checked the query for insertion and found nothing wrong in it (FROM Statement is just where it is expected, that is) but somehow its not working.
    Can somebody help me out as i have done it before on other Installations and dont know why it is occuring that too for the simplest thing in ODI ...
    Regards,
    Nitesh.

    Probably you missed the concat operator.
    select rpad(nvl(lu_parid,' '),1,19)|| v_comma ||
    rpad(nvl(lu_class,' '),1,3)
    from temp_te07                                                                                                                                                                                                                                                                                                           

  • How to insert  data into BLOB column  using sql

    Hi all,
    How to insert data into BLOB column directly using sql .
    create  table temp
      a blob,
      b clob);
    SQL> /
    Insert into temp  values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ;
    ERROR at line 1:
    ORA-01465: invalid hex number
    Please help in this.Thanks,
    P Prakash

    see this
    How to store PDF file in BLOB column without using indirect datastore

  • Column Not found error while trying to access database through JSP+Java Bea

    I am trying to access MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the database is incorporated in the bean.The JSP only calls the particular method of the bean .
    Code for Java Bean:
    package ActiveViewer;
    import java.sql.*;
    import java.util.*;
    public class CompanyBean
    Connection con;
    ResultSet rs=null;
    Statement st;
    public CompanyBean(){}
    public void connect()
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Here4");
    con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
    System.out.println("Here1");
    catch (ClassNotFoundException e)
    System.out.println("Could not locate driver.");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An unknown Exception has occured :: "+e);
    e.printStackTrace();
    public void disconnect()
    try
    if (con!=null)
    con.close();
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    public ResultSet select(String username)
    if(con!=null)
    try
    st=con.createStatement();
    rs=st.executeQuery("select * from company where username='" + username + "'");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An Exception has occured while retrieving :: "+e);
    e.printStackTrace();
    else
    System.out.println("Connection to database was lost.");
    return rs;
    The code for JSP that uses the above bean is:
    <%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
    <jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
    <html>
    <body>
    <% String username=request.getParameter("username");
    String password=request.getParameter("password");
    System.out.println("username:"+username);
    System.out.println("password:"+password);
    conn.connect();
    ResultSet rs=conn.select(username);
    System.out.println("Below select ");
    while (rs.next())
    String dbusername=rs.getString("username");
    String dbpassword=rs.getString("password");
    if(dbusername.equals(username) && dbpassword.equals (password))
    { %> out.println("OK");
    <% }
    else { %>Invalid Username and / or Password.
    <br>Clickhere to go back to Login Page.
    <% }
    } %>
    </body>
    </html>
    I get the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Column not found
    though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
    Here4 (from connect method above)
    Here 1 (from connect method above)
    Below Select (from jsp)
    This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
    All other things like creating package for bean in WEB-INF/classes,incorporating the packakage are done.
    Can someone please help me with their precious advice?

    Hi, I too have a problem with an SQL exception, the message is Column not found.
    I'm using the sun jdbc odbc driver with access.
    the first few lines of the stack trace are
    sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1852)
    sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
    net.homeip.sdaniels.MemberBean.ejbFindByUnamePwd(MemberBean.java:127)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    I am of course sure that the column does infact exist. I can insert into the column no problems. the sql looks like this:
    SELECT * FROM Members WHERE uName ='Stewart' AND encPwd='�F2C�3����h�1Y�'
    Can any one tell me if there is a common cause to this problem?
    Thanks

  • ERROR WHILE INSERTING BLOBS AS PARAMETERS OF EXISTING STORED PROCEDURE

    I have 2 simple tables to keep large application data (as XMLDOCUMENT in one table and BLOB in another):
    SQL> desc bindata_tbl;
    Name Null? Type
    BDATA_ID NOT NULL NUMBER(10)
    BDATA NOT NULL BLOB
    SQL> desc metadata_tbl;
    Name Null? Type
    MDATA_ID NOT NULL NUMBER(10)
    MDATA NOT NULL SYS.XMLTYPE
    and stored preocedure to input new data into those tables:
    "SP_TEST_BIN_META_DATA"
    i_MetaData in METADATA_TBL.MDATA%TYPE,
    i_BinData in BINDATA_TBL.BDATA%TYPE
    as
    begin
    if i_MetaData is not null then
    insert into METADATA_TBL (MDATA_ID, MDATA)
    values (METADATA_SEQ.nextval, i_MetaData);
    end if;
    if i_BinData is not null then
    insert into BINDATA_TBL (BDATA_ID, BDATA)
    values (BINDATA_SEQ.nextval, i_BinData);
    end if;
    COMMIT;
    -- Handle exceptions
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    RAISE;
    end;
    I communicate with database from .Net application using "Oracle.DataAccess 10.1.0.200 (Runtime version v1.0.3705)" component.
    Following procesure is a [simplified] examlple of the code I use, which demonstrates the errors while inserting XMLDOCUMENT and BLOB values simultaneously.
    In my application those should be quite big objects (~200 K XML and ~5-25M binary image data), but following sample keeps failing even with very small-sized objects:
    Line Number
    1          private void PureTest()
    2          {
    3               OracleConnection conn = null;
    4               OracleTransaction tx = null;
    5               OracleCommand command = null;
    6
    7               try
    8               {
    9                    // Open connection
    10                    string strConn = "Data Source=AthenaWf; User ID=AthenaWf; Password=Poseidon";
    11                    conn = new OracleConnection( strConn );
    12                    conn.Open();
    13
    14                    // Begin transaction (not sure if really needed)
    15                    tx = conn.BeginTransaction();
    16
    17                    // Create command
    18                    string strSql = "SP_TEST_BIN_META_DATA";
    19                    command = new OracleCommand();
    20                    command.Connection = conn;
    21                    command.CommandText = strSql;
    22                    command.CommandType = CommandType.StoredProcedure;
    23
    24                    // Create parameters
    25                    // 1) XmlType parameter
    26                    string strXml = "<?xml version=\"1.0\"?><configuration testValue=\"123456789\"/>";
    27                    XmlDocument xmlDoc = new XmlDocument();
    28                    xmlDoc.LoadXml( strXml );
    29                    OracleXmlType oraXml = new OracleXmlType( conn, xmlDoc );
    30                    //oraXml = null;
    31                    //
    32                    OracleParameter xmlPrm = new OracleParameter();
    33                    xmlPrm.ParameterName = "i_MetaData";
    34                    xmlPrm.Direction = ParameterDirection.Input;
    35                    xmlPrm.OracleDbType = OracleDbType.XmlType;
    36                    xmlPrm.Value = oraXml;
    37                    command.Parameters.Add( xmlPrm );
    38
    39                    // 2) Blob type
    40                    byte[] buf = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    41                    OracleBlob oraBlob = new OracleBlob( conn, true );
    42                    //oraBlob.Write( buf, 0, buf.Length );
    43                    oraBlob = null;
    44                    //
    45                    OracleParameter blobPrm = new OracleParameter();
    46                    blobPrm.ParameterName = "i_BinData";
    47                    blobPrm.Direction = ParameterDirection.Input;
    48                    blobPrm.OracleDbType = OracleDbType.Blob;
    49                    blobPrm.Value = oraBlob;
    50                    command.Parameters.Add( blobPrm );
    51
    52
    53                    // Execute command finally
    54                    command.ExecuteNonQuery();
    55                    tx.Commit();
    56               }
    57               catch( Exception ex )
    58               {
    59                    // Clean-up
    60                    if( command != null )
    61                    {
    62                         command.Dispose();
    63                    }
    64                    if( tx != null )
    65                    {
    66                         tx.Dispose();
    67                    }
    68                    if( conn != null )
    69                    {
    70                         conn.Dispose();
    71                    }
    72
    73                    // Display error message
    74                    MessageBox.Show( ex.Message, "Error" );
    75               }
    76          }
    If I try insert only XMLDOCUMENT object (lines 30, 42 are commented out, 43 IS NOT) - everything is OK.
    If I try to insert only BLOB object (lines 30, 42 are NOT COMMENTED OUT, line 43 is commented out) - everything is OK again.
    If I try to insert them both having some values (lines 30, 43 are commented out, 42 is not commented out) - it fails right on "command.ExecuteNonQuery();" (line 54)
    with the following exception:
    "ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%]".
    Even when I nullify oraBlob before assigning it to OracleParameter value (line 30 is commented out, line 42 and 43 are not) I have the same exception.
    XMLDOCUMENT and DLOB data logically are very coupled objects (in my application), so I really want to insert them simultaneously in one stored procedure in transactional way.
    Is it bug of drivers, server, .net environment, or I miss something in implementation?
    PS. In some articles on Oracle web and in MSDN site I found a mention about necessity of wrapping all write/update operations in a transaction, while working with temporary LOBs. I use it here, but it does not look like changing anything.

    Hello,
    I tested your code with the 10.1.0.4.0 ODP and 10.1.0.4.0 Client and it worked fine.
    Can you please apply the 10.1.0.4.0 patches for both ODP and client to see if this resolves the issue for you.
    Here is the output from the same execution of the ODP application you provided as a testcase. These rows were inserted at the same time when I executed the application and passed the data as parameters to the SP you provided.
    Results of Testing with 10.1.0.4.0
    ==========================
    SQL> select count(*) from BINDATA_TBL
    2 ;
    COUNT(*)
    1
    SQL> select count(*) from METADATA_TBL;
    COUNT(*)
    1
    SQL> select dbms_lob.getlength(bdata) from BINDATA_TBL;
    DBMS_LOB.GETLENGTH(BDATA)
    10
    SQL> select mdata from METADATA_TBL;
    MDATA
    <?xml version="1.0"?><configuration testValue="123456789" />

  • ORA- 01461 : Can Bind a long value only for insert into a column error

    I was trying to create a new job using dbms_job.isubmit
    begin
    sys.dbms_job.isubmit(job => 1111,
    what => '',
    next_date => to_date('21-10-2011 03:00:00', 'dd-mm-yyyy hh24:mi:ss'),
    interval => 'TRUNC(SYSDATE+1)+3/24');
    commit;
    end;
    However, I am getting the error 'ORA- 01461 : Can Bind a long value only for insert into a column error'.
    I tried a lot but cant get rid of.
    Any help gurus ?

    You have an error in the code:
    1. you don't provide a value for 'what' - you have to tell Oracle what it should execute when it submits the job.
    And remember - with ISUBMIT the next_date parameter has datatype VARCHAR2 - SUBMIT uses datatype DATE. So make sure you provide a VARCHAR2 value and do not rely on implicit conversion.
    >
    PROCEDURE DBMS_JOB.ISUBMIT
    (job IN BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN VARCHAR2
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);
    PROCEDURE DBMS_JOB.SUBMIT
    (job OUT BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN DATE DEFAULT SYSDATE
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);

  • How to insert document into xmltype column through an http post request with perl

    Oracle 11.2.0.3
    Windows server 2008r2
    Apache tomcat 7.0
    Oracle APEX 4.2.1
    Oracle APEX Listener 2.0
    I would like to insert a XML document into the database through an APEX restful web service. The POST into the web service in done with PERL. The following code will insert an empty record in a table with column of XMLType type.
    Perl Code
    use strict;
    use warnings;
    use LWP::UserAgent;
    use HTTP:Headers;
    my $headers = HTTP::Headers->new();
    my $url = "http://host:port:apex/<application_workspace>/<restfull service module>/<uri template>/
    my $sendthis = ('<?xml version="1.0" enconding="utf-8"?>
    <students>
    <row>
           <name>Mark</name>
          <age>30</age>
    </row>
    <./students>';)
    $headers -> header('Content-Type' => 'text/xml; charset=utf-8');
    my $request = HTTP:Request->new('POST', $url, $headers, $sendthis);
    $request-> protocol('HTTP/1.1');
    my $browser = LWP::UserAgent->new();
    my $response = $browser->request($request);
    my $gotthis= $response->content();
    my $the_file_data = $response->content();
    APEX restful service
    Method: POST
    Source type: PL/SQL
    MIME Types allowed: blank
    require secure access: none
    source:
    {declare
    doc varchar2(32000);
    begin
    insert into table <column name>
    values(doc);
    commit;
    end;
    Table code
    { create table <tablename>
    (column name XMLType>);
    The above code will insert an empty column into the table.
    Any ideas why?

    It's a really bad idea to assemble XML using strings and string concatenation in SQL or PL/SQL. First there is a 4K limit in SQL, and 32K limit in PL/SQL, which means you end up constructing the XML in chunks, adding uneccessary complications. 2nd you cannot confirm the XML is valid or well formed using external tools.
    IMHO it makes much more sense to keep the XML content seperated from the SQL / PL/SQL code
    When the XML can be stored a File System accessable from the database, The files can be loaded into the database using mechansims like BFILE.
    In cases where the XML must be staged on a remote file system, the files can be loaded into the database using FTP or HTTP and in cases where this is not an option, SQLLDR.
    -Mark

  • Problem while inserting into a table which has ManyToOne relation

    Problem while inserting into a table *(Files)* which has ManyToOne relation with another table *(Folder)* involving a attribute both in primary key as well as in foreign key in JPA 1.0.
    Relevent Code
    Entities:
    public class Files implements Serializable {
    @EmbeddedId
    protected FilesPK filesPK;
    private String filename;
    @JoinColumns({
    @JoinColumn(name = "folder_id", referencedColumnName = "folder_id"),
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Folders folders;
    public class FilesPK implements Serializable {
    private int fileId;
    private int uid;
    public class Folders implements Serializable {
    @EmbeddedId
    protected FoldersPK foldersPK;
    private String folderName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "folders")
    private Collection<Files> filesCollection;
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Users users;
    public class FoldersPK implements Serializable {
    private int folderId;
    private int uid;
    public class Users implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer uid;
    private String username;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
    private Collection<Folders> foldersCollection;
    I left out @Basic & @Column annotations for sake of less code.
    EJB method
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    FoldersPK folderPk = new FoldersPK(folderID, uid);
         // My understanding that it should automatically handle folderId in files table,
    // but it is not…
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    It is giving error:
    Internal Exception: java.sql.SQLException: Field 'folderid' doesn't have a default value_
    Error Code: 1364
    Call: INSERT INTO files (filename, uid, fileid) VALUES (?, ?, ?)_
    _       bind => [hello.txt, 1, 0]_
    It is not even considering folderId while inserting into db.
    However it works fine when I add folderId variable in Files entity and changed insertFile like this:
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    file.setFolderId(folderId) // added line
    FoldersPK folderPk = new FoldersPK(folderID, uid);
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    My question is that is this behavior expected or it is a bug.
    Is it required to add "column_name" variable separately even when an entity has reference to ManyToOne mapping foreign Entity ?
    I used Mysql 5.1 for database, then generate entities using toplink, JPA 1.0, glassfish v2.1.
    I've also tested this using eclipselink and got same error.
    Please provide some pointers.
    Thanks

    Hello,
    What version of EclipseLink did you try? This looks like bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280436 that was fixed in EclipseLink 2.0, so please try a later version.
    You can also try working around the problem by making both fields writable through the reference mapping.
    Best Regards,
    Chris

Maybe you are looking for