Reading large large string from database

I am reading is a large string value. It's data type in Oracle is CLOB. I was originally casting it to vARCHAR2(4000) in the select statement, but just realized the data can be larger than 4000. I took out the cast and have tried changing to several data types, but they all error out. How can I read in string data greater than 4000 characters?

You must use Java to do this, the Execute Script operation makes it simple. I have put together a little process to demonstrate, and I can paste the Java from the Execute Script step below.
It's all in the data-typing. In the sample I built, the BigString and NewBigString process variables are of LiveCycle type "string" with unlimited size. These become CLOBs in the database. When read as a CLOB object using JDBC, converted to Java Strings, they then can be loaded into the LiveCycle Process data and the API handles the rest.
Let me know if I'm not clear enough with my explanation.
Jeff A Yates
http://www.avoka.com
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.sql.DataSource;
import javax.naming.InitialContext;
int processId = patExecContext.getProcessDataIntValue("/process_data/@id");
InitialContext context = new InitialContext();
Connection connection = ((DataSource)context.lookup("java:/IDP_DS")).getConnection();
String queryQuery = "select bigdocument, bigstring from tb_pt_workwithxlobs where process_instance_id = ?";
PreparedStatement queryStatement = connection.prepareStatement(queryQuery);
try {
queryStatement.setInt(1, processId);
ResultSet results = queryStatement.executeQuery();
results.next();
java.sql.Blob documentBlob = results.getBlob(1);
com.adobe.idp.Document document = new com.adobe.idp.Document(documentBlob.getBinaryStream());
patExecContext.setProcessDataValue("/process_data/@NewBigDocument", document);
java.sql.Clob stringClob = results.getClob(2);
patExecContext.setProcessDataValue("/process_data/@NewBigString", stringClob.getSubString(1L, (int)stringClob.length()));
} catch(Exception ex) {
ex.printStackTrace();
queryStatement.close();
connection.close();

Similar Messages

  • To read a connection string from a notepad

    i want to read the DSN-less connection string from a notepad that is from a text file so that if server ip address changes then it will be easy to change the ip address in the notepad rather than changing the code .we are using jsp.
    Connection con=DriverManager.getConnection("jdbc:odbc:DRIVER={SQL Server};Database=profile;Server=10.11.144.124;uid=sa;pwd=sa123");
    so this connection should be read from the text file
    any suggestions
    Thanks for ur help

    i want to read the DSN-less connection string from a
    notepad that is from a text file so that if server ip
    address changes then it will be easy to change the ip
    address in the notepad rather than changing the code
    .we are using jsp.
    Connection
    con=DriverManager.getConnection("jdbc:odbc:DRIVER={SQL
    Server};Database=profile;Server=10.11.144.124;uid=sa;p
    wd=sa123");
    so this connection should be read from the text file
    ny suggestions
    Thanks for ur help=> Good way of getting the DSN or any other setting from a text file is create a simple bean(will have get and may have set method too)that will read the data from the text file and use the bean anywhere in your jsp page(As it will also improve the performance of the application)and the bean initilizd once can be reused anywhere in the application.

  • Strange problem retreiving string from database

    Hi,
    I am receiving a very strange problem retreiving a string from a database. The database I am using is Access. I am using .getString(COLUMN_NAME) to get the data from the particular record in the result set. The problem is that sometimes it does not seem to get the entire information that is in the cell. I have found that it is completely random on when it will get the entire contents and when it will only get a portion. It seems like once it gets only a portion though, that every other retrieval of the same field on a different record in the result set will yield the same cut-off point. Of course to make my life even more difficult, it is not always the same cut-off point on a different result set.
    Has anyone else experienced anything along these lines? Any help would be greatly appreciated as I am running out of ideas as to the cause.
    Thank you

    I've printed out exactly what is being retrieved from the fields in question and that's how I narrowed it down to that it has to do with the retrieval of the information from the result set. I've found the exact line of code where I am suddenly receiving only part of the data. And all I'm doing there is just getting the data from the result set. Nothing fancy at all. So unless the result set is becomming corrupt somehow...not sure how that would happen though by just cycling through?

  • Retrieving Strings from Database query ??

    Hi,
    The problem i'm having at the moment is, with the following code:
    connect = DriverManager.getConnection("jdbc:mysql://ash.bc.ic.ac.uk/KEGG_devel?user=null&password=guest");
    Statement stmnt1 = connect.createStatement();
    ResultSet rs1 = stmnt1.executeQuery("SELECT DISTINCT A.ReactID, A.ECid FROM ECReact As A INNER JOIN ECReact As B ON A.ECid = B.ECid AND A.id <> B.id ");
    System.out.println("the size of rs1 is: " +rs1.getFetchSize());
    while (rs1.next()){
    String reactionId = rs1.getString("ReactID");
    String ecNumb = rs1.getString("ECid");
    System.out.println("the value of ecNumb is :" +ecNumb);
    I want to be able to retrieve a String from the query called ECid - an example of such a String would be 4.2.1.86 or 4.2.1.44. However, when i'm Storing the "ECid" in a String called ecNumb and then printing the String all that i get returned is the last 2 digits !
    Does anyone know how to resolve this ??
    Thanks very much for any help
    (oh yeah + for future reference, how do i highlight code in topics??)

    to highlight code... isSimple...
    [bold] [ code][bold]
    your code pasted in here
    [bold] [ / code][bold]
    but leave out the spaces in the []
    i had to add them to get [ c o d e ] to show up.
    m.

  • Problem - reading an abitrary string from the command line in basic swing

    Hi,
    I'm sorry if this problem is a bit basic, but I've only just started swing in Java. Anyway, I'm trying to adapt a basic swing version of the HelloWorld class. When I try to pass an abitrary string from the command line to the label within the class, I get the following error,
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
            at week2.HelloWorldSwing_commandline.main(HelloWorldSwing_commandline.java:31)
    Java Result: 1I must be missing something because I can't see where the problem is in the following code.
    import javax.swing.*;
    import java.awt.*;
    public class HelloWorldSwing_commandline {
        String message;
        private static void createAndShowGui(String message){
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("HelloWorldSwing");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JLabel label = new JLabel(message);
            Container content = frame.getContentPane();
            content.add(label);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[ ] args) {
         createAndShowGui(args[1]);
    }Any help would really be appreciated.

    Hi,
    I've tried changing the index value to O in the main method, but I still get the same error.
    I'm running this in NetBeans 4.1, and when I try to run the class I get the error as listed above.
    Any ideas how to correct this error?
    Thanks

  • Problems reading non-english fields from database on Unix platform

    Hello!
    I am trying to get some data(not in English) from the database and write it to the file. I use ResultSet for that perpose. On PC the program runs all right, but when I run it on Unix, I get garbage instead of letters in my output file. I tried different combinations: such methods of ResultSet like getString, getAsciiStream, getBinaryStream, getCharacterStream and encodings like
    String str = new String(rs.getBytes(), "USO-8859-1"/"UTF-8").
    Nothing helps!
    There is either garbage or "?" instead of letters.

    Hi,
    I think that It comes from your unix system that don't support accentuated characters (and your code can't resolve it).
    You can search in this way...

  • How to read block of rows from database tables

    I have created a Database Application in Java and display all the records in tabular format of one Table. This table have Millions of Rows, If I run Select * from Table, then my Machine not responding, so Now I wants to add paging of 1000 rows at one time.
    Is there are any option to read block of rows at one time and then query again for next page ?
    Please let me know..
    Database : SQL Server 2000/2005, Oracle and MYSQL
    Thanks in Advance
    Laxmilal

    Refer to the SQL documentation of the database server how to query a subset of records.
    This has certainly nothing to do with JDBC nor Java, but with SQL.

  • Help required in writing And Reading Xml From Database

    Hi
    i m new to java.
    i m facing problem while writing Xml file from Mysql Database in java i m using the WebRowSet
    and also for Reading WebRowSet
    after reading the Xml i have to save this in Database
    (required source code)
    is there any one to help me in this way
    regards
    aamir

    shadab_think_globally wrote:
    {noformat}*hi everybody,
    please send me a ajax with jsp application
    suppose i enter a word in text area ajax will populate/suggest all string from database ,who started
    from that entering character(s).like a google string search.
    please send full source code
    *{noformat}how about you do it yourself?

  • Help me in writing ajax string search from database

    {noformat}*hi everybody,
    please send me a ajax with jsp application
    suppose i enter a word in text area ajax will populate/suggest all string from database ,who started
    from that entering character(s).like a google string search.
    please send full source code
    *{noformat}

    shadab_think_globally wrote:
    {noformat}*hi everybody,
    please send me a ajax with jsp application
    suppose i enter a word in text area ajax will populate/suggest all string from database ,who started
    from that entering character(s).like a google string search.
    please send full source code
    *{noformat}how about you do it yourself?

  • Time changes when retrived from Database.

    I insert the time in a string format to the database (dd-MM-yyyy hh:mm:ss). I retrive the string from database & parse it to date using .parse(string) function. But the date retrived is not the date present in database.
    Database value is 15/09/2001 01:30:30
    & the retrived value is 21-02-0021 01:30:30
    How do i set the time difference !!!

    Your .parse(string) is for some reason assuming that your date is in yy/mm/dd format. It takes day 2001 of month 9 in year 15 and normalizes that to be day 21 of month 2 in year 21. You haven't said what you are using to parse the string, but if it's a SimpleDateFormat then you need to review how you are setting it up.

  • IMPORT  x TO y FROM DATABASE dbtab(ar) ID Key

    Hi Experts,
    I'm upgrading me version of SAP to ECC6, so when I execute a program an error triggered when importing object "ADDONS".
    I got this message :
    An exception occurred that is explained in detail below.  
    The exception, which is assigned to class 'CX_SY_IMPORT_MIS not caught in procedure "ISU_BILLPRINT_INTERVALS_CLOSED"
    "(FUNCTION)", no by a RAISING clause.                                     
    Since the caller of the procedure could not have anticipate exception would occur, the current program is terminated. 
    The reason for the exception is: When attempting to import data, the structure of the complex object h1 _ "ADDONS"_h1 was not compatible with the target object. The error occurred with component no. 0.  
    When I launch the ABAP Debugger, It stops at this part of code :
    * Read basics and addons from database
      import basics to l_basics
             addons to RED_PARAMS
             from database rfdt(kk) id l_runkey.
    I realised a small research on the net to get an idea about The ABAP statement IMPORT  x TO y FROM DATABASE dbtab(ar) ID Key, I found this :
    TABLES INDX.
    DATA: INDXKEY LIKE INDX-SRTFD,F1(4),
    F2 TYPE P,BEGIN OF TAB3 OCCURS 10, CONT(4),
    END OF TAB3.
    INDXKEY = 'INDXKEY'.
    IMPORT F1 F2 TAB3 FROM DATABASE INDX(ST) ID INDXKEY.
    But I didn't understand what's  ST?
    So can any guru tell me what's the meaning of ST, and how can I resolve the above problem.
    I know that my problem consists on a difference between the structure of ADDONS and RED_PARAMS.
    NB: The structure of  RED_PARAMS is as follows :
    R_VKONT               
    R_PARTNER        
    R_PORTION             
    R_ABRVORG  
    R_FIKEY                    
    R_ERGRD            
    R_DRUCKDAT    
    SIMU                      
    INVOICED               
    TOBRELSD            
    GENPARA               
    TEST_PR                
    XSTR_PRINTPAR  
    EXLOG          
    PS: I don't have access to ADDONS (Which I don't know what is it?!!!)    
    Regard
    SMAALI Achraf

    We've encountered a very similar issue in an upgrade scenario. The same error message regarding missing or incorrect ADDONS ...
    Our issue was an inconsistency when passing 'old' parameters / program variants to 'mass activities' programs for transactions such as 'FPSCHEDULER' and/or 'EL16' ...
    We did also open an OSSmsg to raise awareness with SAP.
    However, a simple workaround/test would be to identify the related programs that are affected by the issue. The variants or relevant setting to these 'mass activities' programs are stored in the cluster table (such as 'DBTAB' or in our case 'RFDT') mentioned in the shortdump message.
    Due to upgrade-changes our stored input did not match the new structure for the upgrade environment.
    When you've identified the relevant program and their variants / parameters, simply recreate the variant or create a new one, so the cluster table stores a new record in the cluster table ...
    In our scenario, we were able to surpass the shortdump.
    This might be only one of few methods to solve related issues. In any case, this simple test can prove to be a good addition for your analysis when posting an OSS.

  • Howto read url query string? Help :(

    Hi everyone, I am trying to read the query string from within an applet loaded from a URL. I am loading netscape with the following URL
    "http://localhost/mypage.html?param1=help"
    I am using code:
    System.out.println(getDocumentBase().getQuery());
    and all I am getting is a null?
    This works with appletviewer so could someone tell me what is going on. I have searched the forum but it seems no answer yet exists for this. Perhaps its not possible?
    Info:
    OS: Redhat Linux 8
    java version "1.3.1_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
    Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)

    hi,
    can it be that there is a problem with netscape?
    it would suggest to try on ie, but you use linux and i dont think theres an ie-version for linux available ;P
    i would try it on a different browser like opera or something.
    thats my suggestion.
    hope this helped
    cu Errraddicator

  • Help with deleting multiple strings from file.......

    I am trying to delete the same string that may appear multiple times in the file. Here is the output to the screen. Here is the code. I have been researching the delete method it says that I have to start at an index position in the string but how would I find out where the multiples strings reside in the file? I am getting the feeling that it won't work for my purpose..???? I am trying to delete all ot the strings "a string of data3" from the file.
    Output
    C:\TestRead>java StringDelete
    Temp String file_data-------- a string of data3a string of data2a string of data
    1a string of data3a string of data2a string of data1a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    Code:
    import java.io.*;
    public class StringDelete
    public static void main(String [] args)
    try
    FileInputStream fis = new FileInputStream("TestFile.txt");
    DataInputStream in = new DataInputStream(fis);
    StringBuffer file_data = new StringBuffer();
    while(in.available() > 0)
    String temp = in.readUTF(); // read in a string from the file
    file_data.append(temp); // append it to the buffer
    System.out.println("Temp String file_data-------- " + file_data);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    boolean keepGoing = true;
    while(keepGoing)
    String toDelete = file_data.substring(0, "a string of data3".length());
    System.out.println("String toDelete-------- " + toDelete);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    if(toDelete == null || toDelete.equals("") )
    keepGoing = false;
    else
    file_data.delete(0,"a string of data3".length());
    catch(IOException e)
    e.printStackTrace();

    Here is the output. I am trying to get each part to work before I go on to the next part that is why some code is commented out.
    I need help to know why string "a string of data3" is not deleted in the towrite string??
    Output:
    C:\TestRead>java NewStringDelete
    String v after remove [ &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1
    &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1 &#9668;a string of data3]
    String towrite after remove &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of
    data1 &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1 &#9668;a string of data
    3
    Code:
    import java.util.Vector;
    import java.io.*;
    public class NewStringDelete
         public static void main(String [] args)
              //String ls = System.getProperty("line.separator");
              //File file;
              Vector v=new Vector();
         try{
              BufferedReader br=new BufferedReader(new FileReader ("TestFile.txt"));
              String s;
              while ((s=br.readLine())!=null)
                   {v.addElement(new String(""+s));}
                        br.close();
         catch(IOException e)
                   e.printStackTrace();
    /*now you have a Vector containing String objects..*/
         String remove = ("a string of data3");
         String towrite="";
    System.out.println("String v after remove " + v);     
         for (int i=0; i<v.size();i++)
              String ss = (String)v.elementAt(i);
              if (ss.equalsIgnoreCase(remove)){continue;}
              //     towrite=towrite+ss+ls;
                   towrite=towrite+ss;
    System.out.println("");               
    System.out.println("");               
    System.out.println("String towrite after remove " + towrite);                    
    /*do filewrite*/
    //try{
    // FileWriter fw=new FileWriter(TestFile.txt);
    // fw.write(towrite);
    // fw.close();
    // catch(IOException e)
    //               e.printStackTrace();

  • Power BI performance issue when load large amount of data from database

    I need to load data set from my database, which have large amount of data, it will take so many time to initialize data before I can build report, is there any good way to process large amount of data for PowerBI? As I know many people analysis data based
    on PowerBI, is there any suggestion for loading large amount of data from database?
    Thanks a lot for help

    Hi Ruixue,
    We have made significant performance improvements to Data Load in the February update for the Power BI Designer:
    http://blogs.msdn.com/b/powerbi/archive/2015/02/19/6-new-updates-for-the-power-bi-preview-february-2015.aspx
    Would you be able to try again and let us know if it's still slow? With the latest improvements, it should take between half and one third of the time that it used to.
    Thanks,
    M.

  • I want to save large pdf files from my computer to my iPad so I can view them in Adobe Reader.

    I want to save large pdf files from my computer to my iPad so I can view them in Adobe Reader. I do not want to view them in iBooks or Quickoffice. Since I cannot email these large files, how can I get them on my iPad? Thanks for your help.

    I think that Adobe reader supports file sharing.
    Connect the iPad to your computer and launch iTunes. Select the iPad on the left side under "devices". Click on the Apps Tab in the window on the right. Scroll down to the File Sharing Apps list under the main apps list. Click on Adobe Reader. Drag the documents into the file sharing window on the right or select them using the "add" button.
    Launch the Adobe reader app and the files should be in there.

Maybe you are looking for

  • How to send a mail by ckicking the button using java

    hi, how to send a mail by clicking the button (like payroll silp in that contain one button if we click that it autometically go through the mail as a attachment) pls frd to me my gmail is [email protected]

  • Work Manager 6.1: Uploading pictures or documents error

    Hi, I'm working with SMP 3.0 and Work Manager 6.1 for Android platform I'm trying to attach a picture and/or a document to a Work Order and to a Notification, but when I start the transmit the following error is displayed in the client: Sending Docum

  • Macbook Core 2 Duo keyboard connector

    I have a bad macbook Core 2 Duo keyboard cable ribbon. Does anyone have some extras for sale or know where I can buy some? I don't want to buy the whole keyboard.

  • Sandard Smart Form output into PDF format.

    Hi to all, Any one please guide me, how  to convert  sandard Smart Form output into PDF format. Regards, Thanesh

  • Multiple gmail calendars not visible after iphone ugrade

    I just upgraded from an iphone 3 to a 4.  I had multiple google calendars syncing with the iphone 3.  After upgrading, my iphone 4 does not show the calendars as before.  There is one calendar visible in the list from the phone app.  It has my google