Inserting data into a Clob

I need to insert data into a Clob (>8k) and have not been able to determine how
to do it without using Oracle's extensions to the JDBC JDK.
Does anyone have a code snippet to show how to populate the Clob in the first
place?
Thanks,
Cully.
Settings from weblogic.properties:
weblogic.jdbc.connectionPool.oraclePoolCSA=\
url=jdbc:oracle:thin:@IHP273:1521:AIRCORE,\
driver=oracle.jdbc.driver.OracleDriver,\
loginDelaySecs=1,\
initialCapacity=1,\
maxCapacity=2,\
capacityIncrement=2,\
allowShrinking=true,\
shrinkPeriodMins=15,\
refreshMinutes=10,\
testTable=dual,\
props=user=csav2;password=csav2
weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePoolCSA=\
guest,everyone
weblogic.allow.reset.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
weblogic.allow.shrink.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
weblogic.jdbc.TXDataSource.CSATXDataSource=oraclePoolCSA

Shiva,
That was it....instead of doing the Blob work all in the same insert
statement, I grabbed a new sequence and inserted a row with an empty_blob().
After that I did an update on that row setting the correct value of the
Blob.
Thanks for the help!!
"Shiva Paranandi" <[email protected]> wrote in message
news:[email protected]...
I tried with SP2 only and it works. The problems might be that you aregetting a
null blob. Try inserting an emtpy blob first. Check out this program whichworks
for me on WLS 6, SP2.
Shiva.
Tony Bailey wrote:
Still getting the NPE. Any other ideas??? Are you able to do this
successfully on sp2?
"Shiva Paranandi" <[email protected]> wrote in message
news:[email protected]...
Try these two things:
1. Change your SQL query to "SELECT image FROM " + table + " for
update";
2. Also, set conn.setAutoCommit(false);
Shiva.
Tony Bailey wrote:
If I step through the code in the debugger, everything is A-OK up
until
the
getBinaryOutputStream, then I get a NPE. The blob appears to be
instantiated when I toString() it in the previous line.
private Blob getBlob(File f, String table)
throws SQLException
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String SQL;
Blob imgblob = null;
FileInputStream fis = null;
OutputStream bos = null;
try
conn = dbutil.getConnection();
SQL = "SELECT image FROM " + table;
pstmt = conn.prepareStatement(SQL);
rs = pstmt.executeQuery();
rs.next();
imgblob = rs.getBlob("image");
logger.log(Debug.DEBUG, "DictTblCtrlr.getBlob(): The
blob
is: "
+ imgblob);
fis = new FileInputStream(f);
bos = ((OracleBlob)imgblob).getBinaryOutputStream();
byte[] buffer = new byte[65534];
int length = -1;
while ((length = fis.read(buffer)) != -1)
bos.write(buffer, 0, length);
bos.flush();
catch (Exception sqle)
logger.log(Debug.ERROR, "DictTblCtrlr.getBlob(): " +
sqle.getMessage());
sqle.printStackTrace();
throw new SQLException(sqle.getMessage());
finally
try { fis.close();  bos.close(); } catch (Exception e)
dbutil.release(rs, pstmt, conn);
return imgblob;
[07-19-2001 03:02:07] DEBUG:DictTblCtrlr.getBlob(): The blob is:
weblogic.jdbc.rmi.SerialBlob@1f1f12
[07-19-2001 03:02:23] ERROR:DictTblCtrlr.getBlob():
java.lang.NullPointerException
java.sql.SQLException: java.lang.NullPointerException
at
weblogic.jdbc.rmi.SerialBlob.getBinaryOutputStream(SerialBlob.java:73)
at
com.uctech.psws.persistence.datacontroller.DictionaryTableController.getBlob
(DictionaryTableController.java:410)
at
com.uctech.psws.persistence.datacontroller.DictionaryTableController.insert(
DictionaryTableController.java:363)
"Shiva Paranandi" <[email protected]> wrote in message
news:[email protected]...
Could you post the exception?
Shiva.
Tony Bailey wrote:
Using the example, I get a NullPointerException when calling
getBinaryOutputStream() under WL6.0sp2.
"Filip Hanik" <[email protected]> wrote in message
news:[email protected]...
look under
$BEA_HOME/wlserver6.0sp1/samples/examples/jdbc/oracle/OracleBlobClob.java
>>>>>>>
~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
[email protected]
www.filip.net
"Cully Orstad" <[email protected]> wrote in message
news:[email protected]...
I need to insert data into a Clob (>8k) and have not been
able
to
determine how
to do it without using Oracle's extensions to the JDBC JDK.
Does anyone have a code snippet to show how to populate the
Clob
in
the
first
place?
Thanks,
Cully.
Settings from weblogic.properties:
weblogic.jdbc.connectionPool.oraclePoolCSA=\
url=jdbc:oracle:thin:@IHP273:1521:AIRCORE,\
driver=oracle.jdbc.driver.OracleDriver,\
loginDelaySecs=1,\
initialCapacity=1,\
maxCapacity=2,\
capacityIncrement=2,\
allowShrinking=true,\
shrinkPeriodMins=15,\
refreshMinutes=10,\
testTable=dual,\
props=user=csav2;password=csav2
weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePoolCSA=\
guest,everyone
weblogic.allow.reset.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
>>>>>>>>
>>>>>>
>>>>
>>
weblogic.allow.shrink.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
>>>>>>>>
weblogic.jdbc.TXDataSource.CSATXDataSource=oraclePoolCSA

Similar Messages

  • Inserting data into a CLOB Field

    I am trying to insert a 100,000+ byte string into a CLOB field in Oracle, but I'm getting a "string literal too long" error. I am using Visual Basic and ADO to try to accomplish this. My insert statement is:
    sql = "INSERT INTO IMAGE_VERSION " & _
    "(field1, field2, field3)" & _
    "VALUES('" & strNm & "', '" & strDt & "', '" & strData & "')"
    Field 3 is defined as a CLOB in the database. From what I understand, the CLOB can hold massive amounts of data.
    Can anyone lend a hand?

    Re: OTN Downloads

  • How to insert data into a CLOB column

    In UIX XML I used a bc4j:textInput control for a CLOB column and I cannot type any letter in this field....Why ?
    Regards,
    Lucian

    Hello again !
    Here are my findings (Content is a CLOB column; I use UIX XML + BC4J):
    1.If I put:
    <inlineMessage prompt="Content" required="no" vAlign="middle" >
    <contents>
    <bc4j:textInput name="Content" attrName="Content" columns="162" rows="5" />
    </contents>
    </inlineMessage>
    I cannot type any letter in the text Input field !!!!!!
    2. If I put
    <inlineMessage prompt="Content" required="no" vAlign="middle" >
    <contents>
    <bc4j:attrScope name="Content">
    <contents>
    <textInput name="Content" columns="162" rows="5">
    <boundAttribute name="text">
    <bc4j:attrProperty name="value"/>
    </boundAttribute>
    </textInput>
    </contents>
    </bc4j:attrScope>
    </contents>
    </inlineMessage>
    I can type in the textInput field, but I cannot save the text after a certain number of characters. Also I cannot see the saved text. I receive :
    Servlet error: Renderer failed: java.lang.ArrayIndexOutOfBoundsException: -35</PRE></BODY></HTML>
    inside the textInput field.
    Please help me ...
    Regards,
    Lucian

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • How to insert data into a table from an xml document

    using the XmlSql Utility, how do I insert data into a table from an xml document, using the sqlplus prompt.
    if i use the xmlgen.insertXML(....)
    requires a CLOB file, which i dont have, only the xml doc.
    Cant i insert directly from the doc to the table?
    the xmlgen examples I have seen first convert a table to a CLOB xmlString and then insert it into another table.
    Isnt there any other way?

    Your question is little perplexing.
    If you're using XML SQL Utility from
    the commandline, just use putXML.
    java OracleXML putXML
    null

  • 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

  • How to insert data into a table only when data has changed its value (when compared to the previous inserted value)

    I wish to insert data into a table only when the value of the inserted data has changed. Thus, in a time series, if the value of the data at time, t-1, is 206 then if the data to be inserted at time t is 206, then it is skipped (not entered).
    If the value of the data at time t+1 is 206, it is skipped also; until the value changes, so if the value at t+1 was 205, then that would be inserted, and if at time t+2 the data is 206, it would be inserted too.
    What is the best way to do it without increasing overheads?

    This view works:
    SELECT
    i.IDNO,i.[Date],i.[Level]
    FROM
    mytable i
    INNER
    JOIN mytable
    d
    ON
    d.IDNO
    = i.IDNO-1
    WHERE
    i.[Level]
    <> d.[Level]
    on this mytable below.  A trigger could be quite useful here although I am cautious using them. However I wish to avoid the overhead by not having a temp table (which could be sizable).  mytable below
    should give 3 lines. The IDNO is an identity column.
    IDNO
    Item
    Date
    Level
    1
    X24
    12/23/13 10:41
    22996
    2
    X24
    12/23/13 10:41
    22996
    3
    X24
    12/23/13 9:21
    23256
    4
    X24
    12/23/13 9:21
    23256
    5
    X24
    12/23/13 9:22
    23256
    6
    X24
    12/23/13 9:22
    23256
    7
    X24
    12/23/13 9:22
    22916

  • How do you access a web service to insert data into table?

    Ok I have a simple html/jsp survey form to host on our web site. Because of firewall issues I cannot do a direct connect to the database and insert the data from the form. So I need to take the data from the survey form, and pass it to an existing web service, or create a web service that will insert this information for me into the database table?
    Thanks again.
    orozco

    Thanks for the reply shanu. Well, because of firewall issues, as a work around we use a web service to insert data into the database table. Since the Web Service already exist, we just thought it would be easy enough just to pass the parameters to it, and have it do the insert. So really all I need is just to communicate with the already existing web service. I will be honest though I have not really worked with web services before.
    orozcom

  • How to insert data into datagrid dynamically and also programatically with data and column names being retrived from a xml file..

    iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap

    A DataGrid is row-based rather than cell-based with each row
    corresponding to an item in an underlying collection (specified in the
    dataProvider property). In order to add data to a DataGrid you
    manipulate the underlying collection, rather than the grid directly.
    Based on the limited description of your problem I would imagine you
    would need to create dynamic objects with property names that correspond
    to the dataFields of your dynamically created datagrid columns.
    So if you had created columns with dataFields "alpha", "beta" and
    "gamma" on your datagrid, you could create an item in your grid by
    adding the following object to your dataProvider:
    var gridItem : Object = new Object();
    gridItem.alpha = "alphaValue";
    gridItem.beta = "betaValue";
    gridItem.gamma = "gammaValue";

  • How to insert data into the mysql table by giving as a text file

    Hi,
    Any one know's how to insert data into the mysql table by giving as a text file as the input in JSP.Please respond ASAP.
    Thanks:)

    At least you can try StringTokenizer to parse your text files. Or download a text JDBC driver to parse your files, for instance, HXTT Text(www.hxtt.net) or StelsCSV(www.csv-jdbc.com).

  • How can I insert data into the standard CRM tables ?

    Hi Experts,
    Scenario----
    I need to download few attributes (fields) from SAP MDM to SAP CRM via SAP XI. I'm using the 'COMT_PRODUCT_MAINTAIN_API' API for it.
    The attributes(fields) that are present in the strucutres of API are downloaded into CRM system (by executing the Inbound proxy that is created based on the Message Interface created on XI) by calling the functions present in the API.
    And for those fields that are not present in CRM, but need to be downloaded into CRM, I'm creating the Set Type attributes in CRM, which get appended to the API.
    My query is:
    There are fields in CRM into which I need to insert the values. But they are not listed in the API. So, how can I insert(/download) the values into these standard fields?
    Regret the long description. Intended to be clear.
    TIA. Points will be awarded.
    Regards,
    Kris
    Edited by: Kris on Jul 21, 2008 8:00 AM

    he INSERT program throws exception???
    can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
    Kaj

  • How can i insert data into DB from my page programatically in Oracle ADF..?

    Hai, this is praveen.
    I have created  an EO and VO, when i have inserted data by dragging and dropping from DataControl -->Operations-->Create. I have successfully inserting data. But how can i do it programatically. What are the pre-defined steps that i can use over there to insert data into table programatically. Could u plz help me?

    Hi,
    You have to create an action Listener in the bean for any button.
    Then call an AM method.
    In that you have to do the following
    ViewObject yourVO = getYourVO();
    Row r = yourVo.createRow();
    r.setAttribute("Column1", value1); //the name of column should be as it is in your vo attribute.
    yourVO.insertRow(r);
    this.getDbTransaction().commit();
    Thanks

  • How can I Insert data into my msaccess Database table

    Hello all,
    I am new to Java programming and I have problem that how can i insert name into my database table.
    The code which i have written is following:
    String filename = "d:/test.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database+= filename.trim() + ";DriverID=22;READONLY=true}";
    Connection con = DriverManager.getConnection(database,"","");
    String s = String.valueOf(text.getText());
    int k =10;
    Statement st = con.createStatement();
    st.execute("create table Test123(name text)");
    st.execute("INSERT INTO Test123 values" +s);
    on the INSERT program throws exception???
    can any one help me how to insert data into tabel.
    Thanks

    he INSERT program throws exception???
    can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
    Kaj

  • Is there a way to Insert Data into a Lookup Column Type on a SharePoint List Destination in SSIS?

    Greetings.
    I have successfully worked out inserting SQL data (2008 R2) into my 2010 SharePoint list (New, Update, Delete) by creating an SSIS Data Flow Task as outlined here:
    http://fsugeiger.blogspot.com/2010/01/synchronise-sql-table-with-sharepoint.html
    However, the problem I am running into is inserting data into the SharePoint Columns that are "Lookup" column types. I verified that all of the values I am copying from SQL into the SharePoint lookup column exist in the customn list it is pointing to. It
    is important to have this column be a lookup column as it links to another custom list that has many more columns of related information.
    I have read and re-read the SharePoint SSIS Adapters 2011.docx from
    http://sqlsrvintegrationsrv.codeplex.com/ and the only section that seems to apply is this:
    "Looking Up Values in a SharePoint List
    If you have to look up a value in a SharePoint list, you can use the Lookup transformation in your data flow, and use the SharePoint List source to load the lookup table. You may have to add a Derived Column transformation or a Script component that splits
    data in the lookup column on the ";#" delimiter to separate the ID value from the description.
    If you are replacing values in your data with the values that you look up in the list, then loading the changed data back into SharePoint, you only have to include the ID from the lookup column. SharePoint ignores the description if you include it."
    I am not sure if the above statement means that I should be passing the assocaited ID's other than the actual data into the SharePoint List destination. If that is the case, that will not really work as the lookup contains hundreds of rows. Not too mention
    I have several of these lookup column types pointing to several different lists.
    Any guidance in how I can put data into a SharePoint Lookup column type via Data Flow Task would be so much appreaciated.
    Thank you.
    My errors are:
    Error: 0x0 at Data Flow Task, SharePoint List Destination: Error on row ID="1": 0x1 - Unspecified error, such as too many items being updated at once (batch), or an invalid core field value.
    Error: 0xC0047062 at Data Flow Task, SharePoint List Destination [1903]: Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.PipelineProcessException: Errors detected in this component - see SSIS Errors at Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.SharePointListDestination.ProcessInput(Int32
    inputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)
    Error: 0xC0047022 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "SharePoint List Destination" (1903) failed with error code 0x80131500 while processing input "Component Input" (1912). The identified
    component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will

    I have found a solution to my problem and thought I would share it here in case there are others who are struggling with the above scenario. If you have a better way, I would love to hear about it since my way is a bit tedious.
    In a nutshell, in order to have an SSIS package put data from an OLE DB Source into a SharePoint List Destination Lookup Column, you need to pass the ID of the value that is being looked up, not the value that is in the “master” OLE DB source.
    Rough explanation, OLE DB Source value for column “Approp” is “4005” --> SQL matches “4005” with the ID in the new lookup table (“4005” = ID “5” as defined in the SharePoint lookup list) --> “5” gets passed into SharePoint List destination lookup
    column --> SharePoint displays “4005” and successfully links to the lookup list.
    Funny thing (not really), the error(s) outlined in my original post are not related in getting data into a SharePoint Lookup column as I am now successful in getting data into the system but I am still getting the same above error(s). I think it has to do
    with the ID column in the SharePoint list destination. What I can’t seem to figure out is why since I am not linking any data to that ID column (at least on new records). I am however linking it on Update and Delete and the errors mentioned above disappear
    and things work well.
    There are three tasks that need to get done in order to get data from SQL into a SharePoint lookup column assuming you have already set up your SharePoint lookup lists:
    1. Create new lookup table(s) in SQL that has the IDs from the SharePoint Lookup list and the values coming from the “master” OLD DB Source. You can see the ID column in SharePoint by toggling it on in a view.
    2. Create a SQL command that JOINs all the databases and tables so that the ID is passed and not the value into the SharePoint lookup column
    3. Change the “Data access mode” to “SQL Command” instead of the “Table or view” in the OLE DB Source and paste your command into the “SQL command text:” area.
    Other helpful info is that you may also need to add additional columns in the new lookup tables in SQL for the scenarios when the data is not unique. You can see this two times in my SQL command example for Units and JobTitles:
    SELECT
    pps.SSNm,
    pps.file_updated,
    pps.Employee_id,
    /* pps.CheckDistNm,*/
    Check_Distribution_id = COALESCE( d.ID, 0 ),
    pps.Job_nbr,
    pps.SeqNm,
    pps.action_eff_dt,
    Fund_id = COALESCE( f.id, 0 ),
    Appropriation_id = COALESCE( ap.id, 0 ),
    ActionCode_id = COALESCE( ac.id, 0 ),
    SpecNumber_id = COALESCE( jt.ID, 0 ),
    pps.Employee_id,
    /* pps.Fund,
    pps.Approp,
    pps.Unit,*/
    Unit_id = COALESCE( u.ID, 0 ),
    PosNm,
    PosCode,
    pps.LastName,
    pps.FirstName,
    pps.MI
    FROM
    x_PPS.aReportVw.pps_screens_active AS pps
    LEFT OUTER JOIN dbo.DistributionNumbers AS d ON
    pps.CheckDistNm = d.Check_Distribution
    LEFT OUTER JOIN dbo.Units AS u ON
    pps.Fund = u.Fund AND
    pps.Approp = u.Approp AND
    pps.Unit = u.Unit
    LEFT OUTER JOIN dbo.Appropriations AS ap ON
    pps.Approp = ap.Approp
    LEFT OUTER JOIN dbo.Funds AS f ON
    pps.Fund = f.Fund
    LEFT OUTER JOIN dbo.ActionCodes AS ac ON
    pps.ActionCode = ac.ActionCode
    LEFT OUTER JOIN dbo.JobTitles AS jt ON
    pps.SpecNm = jt.SpecNumber AND
    pps.JurisClass = jt.JurisClass

  • Use Spry to insert data into a database?

    I'm new to Spry, so I have a question:
    Can I use Spry to insert data into a MySQL database without
    reloading the site?
    Reading data from XML file works fine, but I don't know if
    writing is possible..

    I don't get it... I tried this:
    <script type="text/javascript" src="spry/xpath.js"
    /></script>
    <script type="text/javascript" src="spry/SpryData.js"
    /></script>
    <script type="text/javascript">
    /* <![CDATA[ */
    function subscribe() {
    var subscribe;
    var info =
    document.getElementById("subscription_info").value;
    if (document.getElementsByName("subscription")[0].checked ==
    true) {
    subscribe = "ja";
    else {
    subscribe = "nein";
    var dsSubscribe = new
    Spry.Data.XMLDataSet("include/inc_subscribe.php?subscribe="+subscribe+"&info="+info+"&sit e=<?=$_GET['site'];?>",
    "subscription/ok");
    /* ]]> */
    </script>
    <div id="infos">
    <input type="radio" name="subscription" value="ja" />
    dabei
    <input type="radio" name="subscription" value="nein"
    /> nicht dabei
    <input type='text' class='text'
    id='subscription_info_text' />
    <input type='submit' id="subscription_submit"
    value='Eintragen' onClick="subscribe()" />
    </div>
    But the data isn't inserted into the mysql database. When I
    start the php script directly, it works, so I think it's not a php
    problem.

Maybe you are looking for

  • How to define BPC architecture?

    Hi All, Iu2019m a BI and BPS consultant and Iu2019m doing a prototype for evaluating BPC for Sales Planning and I need some help. Process flow as: a.     Extract sales from COPA (amount and quantities); b.     Copy Actual to Budget version; c.     Cr

  • Query on Functions & Procedures

    Hi, I have worked on webservices in forms. To access the code in webservices, I import the JAR file(which has the webservices code) in the forms wherein the code gets converted to equivalent Procedures and Functions. Now I want to access this code in

  • Cannot download zip file

    Why is it that with Firefox 8 I cannot download a zip file that was sent to me as an e-mail attachment? When I select the zip file a pop asks me if I want to 'open with' or 'save file'. Whichever option I choose the file is named attachment.ashx (thi

  • URLEncoder.encode() for double-byte characters

    I use URLEncoder.encode(String s) and I know that this api is deprecated. Instead I use URLEncoder.encode(String s, String enc) api and I pass-in a URL as the value for 1st parameter which is "http://regexp.tistory.com/entry/깨진-한글-URL-변환" and for the

  • Message Bridge from MQ on Linux

    I am trying to set up a message bridge on Linux, using the same procedure I successfully used on Windows. I got the following error message:           <Warning> <Connector> <BEA-190032> << Weblogic Messaging Bridge Adapter (XA)_eis/jms/WLSConnectionF