Toplink 9.0.4.6, Batching and CLOBS

Hello,
New to this forum, new to Java and very new to Toplink. So, please forgive me if I ask a stupid question or two.
I have written a java program whose purpose is to migrate data from one schema to another. For the most part, it works well, except for a few issues.
The legacy table contains a number of varchar(4000) fields (Oracle 9i), and the equivelant fields in the new schema (Oracle 10g) are CLOB fields. I ran my migration code a few times, and found it a bit too slow for my liking. In an effort to speed it up, I did the following:
1. Turned on batching in the connection to the database
2. Refactored java code to allow for batching commits to the database
After doing this, migration code runs a lot faster, but, now I have an issue with writing from the Varchar(4000) fields to CLOB fields. To be specific, about half the records that are migrated wind up with either null values in the corresponding CLOB fields, or a series of spaces - but not the text that should be there. To reiterate, in some cases the data seems to migrate fine, in others, well, not so fine or not at all.
My question is this: is this a known issue? If so, how do I fix it? Before I started batching my commits, things seemed to be going well.
Not sure what else to include here, other than the following, which you may find useful:
Sessions.xml settings:
UseNativeSequencing = True
ShouldBindAllParamters = True
UsesStringBinding = True
UsesStreamsForBinding = True
UsesBatchWriting = True
UsesJDBCBatchWriting = True
Actually, not sure if you need this information or not. Should you need further information, please do not hesitate to ask. Apologies again for my glaring lack of expertise in these matters, and any help would be greatly appreciated.
Thanks!

Hi,
I am going to use the following codes which I read from the ADF Developer Guide for SRDemo (with a little bit of adjustment):
public void fileUploaded(ValueChangeEvent event) {
InputStream in;
FileOutputStream out;
// Set fileUPloadLoc to "SRDemo.FILE_UPLOADS_DIR" context init parameter
String fileUploadLoc =
FacesContext.getCurrentInstance().getExternalContext().getInitParameter("SRDemo.FILE_UPLOADS_DIR");
if (fileUploadLoc == null) {
// Backup value if context init parameter not set.
fileUploadLoc = "/tmp/srdemo_fileuploads";
//get svrId and append to file upload location
Integer svrId =
(Integer)JSFUtils.getManagedBeanValue("userState.currentSvrId");
fileUploadLoc += "/sr_" + svrId + "_uploadedfiles";
// Create upload directory if it does not exists.
boolean exists = (new File(fileUploadLoc)).exists();
if (!exists) {
(new File(fileUploadLoc)).mkdirs();
UploadedFile file = (UploadedFile)event.getNewValue();
if (file != null && file.getLength() > 0) {
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage(JSFUtils.getStringFromBundle("srmain.srfileupload.success") +
" " + file.getFilename() + " (" +
file.getLength() + " bytes)");
context.addMessage(event.getComponent().getClientId(context),
message);
try {
out = new FileOutputStream(fileUploadLoc + "/" + file.getFilename());
in = file.getInputStream();
for (int bytes = 0; bytes < file.getLength(); bytes++) {
out.write(in.read());
in.close();
out.close();
} catch (IOException e) {
e.printStackTrace();
} else {
// need to check for null value here as otherwise closing
// the dialog after a failed upload attempt will lead to
// a nullpointer exception
String filename = file != null ? file.getFilename() : null;
String byteLength = file != null ? "" + file.getLength() : "0";
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_WARN, JSFUtils.getStringFromBundle("srmain.srfileupload.error") +
" " + filename + " (" + byteLength +
" bytes)", null);
context.addMessage(event.getComponent().getClientId(context),
message);
Two questions:
One, I am going to read in the file as a byte[], from my readings, I know that I would have to use a custom UploadedFileProcessor to save files to the Database. How can I save that file as a blob into the Database? Can you let me know of some code samples? I am working with ADF Faces and TopLink, not Business Component.
Two, regarding your reply on 1/16, could you explain how do I map my byte[] to a blob?
Appreciate your assistance.
Lin

Similar Messages

  • Toplink, XML and CLOB/NCLOB

    Hi
    New problem with Toplink;)
    We want to insert an XML into a NCLOB field in the database. The NCLOB field is mapped to a String field in my object model. Toplink generates and executes the SQL but the data is not inserted. When I cut and paste the SQL into TOAD it generates an "invalid character" message on the insert. Toplink gives no error message.
    We use toplink in a J2EE web-app and are therefor useing a thin jdbc driver. The toplink version is 9.0.4.
    Has anyone done anything like this?
    Thanks!

    Hi Bent,
    Could you please post the log with TopLink-generated SQL.
    Also I would try to determine whether it's "N" or "CLOB" that causes the problem.
    If you change NCLOB to NVARCHAR2 is the problem still there?
    If you change NCLOB to CLOB is the problem still there?
    This article describing LOB mapping in TopLink may be helpful, too:
    http://www.oracle.com/technology/products/ias/toplink/technical/tips/LOB/index.html

  • Stock on posting date with storagelocation,batch and stock types informatio

    Hi,
    I'm needing a report (similar funtion of MB5B) which must reveal the stock postion (closing balance) of the materials on a particular date alongwith storage loactions, batches and stocktypes (Unres/Q/Blkd).As such MB5B either gives the output either by storage location or by batch, not the combination of both.
    Else provide any possibilty means( Database tables) from where i could arrive these mention outputs.
    I could be able to get the information by collecting the values from MKPF & MSEG tables. But this information only suffice the material movements carried on that particular date.. And i will be not having the closing balance as a whole.
    I even wonder to get any such a kind of information in which i could able to get the stock with stock types(Unres/Q/Blkd).
    Any light on this matter is highly appreciable.
    Regards
    Prasanna

    Hi Amit Bakshi,
    Thanks for the reply..
    I executed the suggested program but i found the same kind of information aslike in MB5B..
    The information all i'm looking is to get the closing balance of the given material with storagelocations, batches and stock types on a given posting date.
    For eg.
    On 15 / 03 / 2011
    Material A
    Batch       Slocation       Stock type               Closing balance Qty.
    A1              S001               Unres.                             50
    A1              S002               Unres                            120
    B1              S001               Quality                             15
    C1              S003               Blocked                            30
    In MB5B i could able to get the values of closing balance either Storage location level or by batch level but is it possible to get the combination of both along with stock types?
    Reg
    Prasanna

  • BLOB and CLOB data in BI Publisher

    Hello,
    I have an XML file with blob and clob data in it. I am using BI desktop publisher to load the xml file and create the rtf template. I am getting the following error:
    ConfFile: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdoconfig.xml
    Font Dir: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    Template: C:\work\employee.rtf
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\work\employee.xml
    FOProcessor setLocale: en-us
    Do i need to install anything or am i missing any configuration to read the blob and clob? Please advise
    thanks

    Check this out, hopefully it'll help you
    http://oraclebizint.wordpress.com/2007/11/12/oracle-bi-ee-101332-working-with-clob-fields/
    Fiston

  • How to copy a table with LONG and CLOB datatype over a dblink?

    Hi All,
    I need to copy a table from an external database into a local one. Note that this table has both LONG and CLOB datatypes included.
    I have taken 2 approaches to do this:
    1. Use the CREATE TABLE AS....
    SQL> create table XXXX_TEST as select * from XXXX_INDV_DOCS@ext_db;
    create table XXXX_TEST as select * from XXXX_INDV_DOCS@ext_db
    ERROR at line 1:
    ORA-00997: illegal use of LONG datatype
    2. After reading some threads I tried to use the COPY command:
    SQL> COPY FROM xxxx/pass@ext_db TO xxxx/pass@target_db REPLACE XXXX_INDV_DOCS USING SELECT * FROM XXXX_INDV_DOCS;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    CPY-0012: Datatype cannot be copied
    If my understanding is correct the 1st statement fails because there is a LONG datatype in XXXX_INDV_DOCS table and 2nd one fails because there is a CLOB datatype.
    Is there a way to copy the entire table (all columns including both LONG and CLOB) over a dblink?
    Would greatelly appriciate any workaround or ideas!
    Regards,
    Pawel.

    Hi Nicolas,
    There is a reason I am not using export/import:
    - I would like to have a one-script solution for this problem (meaning execute one script on one machine)
    - I am not able to make an SSH connection from the target DB to the local one (although the otherway it works fine) which means I cannot copy the dump file from target server to local one.
    - with export/import I need to have an SSH connection on the target DB in order to issue the exp command...
    Therefore, I am looking for a solution (or a workaround) which will work over a DBLINK.
    Regards,
    Pawel.

  • How can I use TopLink for querys that have two and more tables?

    I use TopLink today, and I can use one table to query, but how can I use TopLink for querys that have two and more tables?
    Thank you for see and answer this question.

    You can write a custom SQL query and map it to an object as needed. You can also use the Toplink query language "anyOf" or "get" commands to map two tables as long as you map them as one to one (get command) or one to many (anyOf command) in the toplink mapping workbench.
    Zev.
    check out oracle.toplink.expressions.Expression in the 10.1.3 API

  • Creation of Batch and maintain characteristics

    Hi,
    I need to create batch and maintain batch classification/characteristics.
    I am doing the following steps
    1. BAPI_BATCH_CREATE --> Crreate the batch
         -Pass material/plant/batch
         -This creates entry in MCHA
    However there is no entry created in MSKA
    2. Get class using BAPI_OBJCL_GETCLASSES
        - Object key = material/plant/nbatch
        - Table = MCHA
        - class type 022
    This BAPI does not return anything saying the classification does not exist.
    However I can see the entry in transaction MSC3N
    There are 2 problems
    1. I need an entry in the MSKA table
    2. Why is BAPI_OBJCL_GETCLASSES not returning the class when the batch is created successfully and is visible in MSC3N
    Thanks for the help
    Karen

    Hi...
    Thanks for your answer...
    I am no able to create the batch using BAPI_BATCH_CREATE.
    The problem was I was not passing values to the parameter BATCHCONTROLFIELDS
    (values of CLASS_NUM = name of class and DOCLASSIFY =X).
    Because of this the entry in MCHA-CLOBJ BM was blank and BAPI_OBJCL_GETDETAIL was not finding the classification.
    No this part is working....
    I now need to have an entry in MSKA...
    Can u tell me how to do this through BAPI or FM
    There is a parameter INTERNALNUMBERCOM for BAPI_BATCH_CREATE...
    will this fill MSKA? I am not sure what values to pass.
    Thanks for the help.
    br
    Karen

  • Vendor batch and batch field on the inbound delivery

    hi GUrus,
    i have looked through most of the threads where the topic of vendor batch and batch on the inbound delviery has comeup. I'm specifically looking at a scneario where i would want to pass the on the batch number provided by the vendor on the IDOC to batch field on the inbound delivery. The reason for this is , i can look at the batch field in the confirmations tab of the PO, in the purchase order histroy tab of the PO, and also MMBE tcode. the material is also batch managed turned on in hte material master. But the issue is that even though i put the batch provided by vendor in the CHARG field on the ASN IDOC, it is still getting populated in the vendor batch field in the inbound delivery.
    any ideas?
    Thanks
    Ravi

    Hi,
       Refer the note:  833668 - Creating batches in the inbound delivery using IDOC  which explains the system design.
    Regards,
    AKPT

  • Bridge CS6: How do you write a script to assign a shortcut to "Batch" and "Image Processor"?

    Many times a day I need to access "Batch" and "Image Processor" in Bridge.
    There is no shortcut, so I have to go the Tools-Photoshop-Batch and Tools-Photoshop-Image Processor menu - the items I need are locked into a second level menu.
    Which is impractical.
    I remember, when I started out with Photoshop many years ago, I downloaded "Deke Keyes" from Deke McClelland, which included keystrokes for "Batch" and "Image Processor".
    From the Bridge forum I learned that you cannot assign shortcuts in Bridge CS6.
    So the general opinon was that a script was used to assign the shortcuts.
    Could you please tell me how to do that?
    Thanks!
    PS: I tried to assign shortcuts via the Mac OS X Mountain Lion keyboard preferences (applications), but it did not work.

    Hi,
    in the exit:Event of the 1st date field add this FormCalc script:
    DateField2 = Num2Date(Date2Num($.formattedValue, "DD.MM.YYYY") + 21, "DD.MM.YYYY")
    You may have to change th date pattern  "DD.MM.YYYY" in the way you need it.

  • Shortcuts for Batch and Image Processor in Bridge CS6

    I use Batch and Image Processor all the time, and I'd like to use a shortcut.
    Can you tell me if there is a shortcut or how I can program one?
    I set up shortcuts for those two commands in Photoshop, but they don't work in Bridge.
    I remember from the time I started with Photoshop and had Deke McClelland's book with his set of shortcuts. There was a shortcut that worked with image processor, but it was just a set you did install and no explanation. When I moved to a different computer and a newer version of Photoshop, these keys got lost.
    Is there any way to automate Batch and Image Processor?

    There is no way to economically batch process in Bridge without having to go thorough sub-menus.
    I'm sorry you can't get it to work, but on my system it works flawless.
    Testing a bit more it seems you don't need to use a unique shortcut at all. I also tried to use the shortcut for Batch I created in PS itself to get the Batch window to front for running actions on open files. For me that is [control + Cmd + B] but feel free to find an other one.
    When I discovered you don't need the unique shortcut at all I used the same shortcut for Bridge CC. . Also created [Control + Cmd + i] for the Image processor.
    Both started without problems.
    To extend I also created both same shortcuts for Bridge CS6. This also was working correctly, off course, having only PS CC open using the shortcut in Bridge CS6 it auto started PS CS6.
    So can you specify a bit more about what OS you are using on what computer (I have OSX 10.8.4 on a MacPro 2012)
    Some screenshots to show the shortcuts in System prefs and how the show in the Bridge Submenus:

  • Display BLOB and CLOB on browser

    Hi All.
    I need to display contents of BLOBs and CLOBs on the browser. They can be any docFlavour eg. .jpg, .gif, .pdf, .doc etc
    Is there some standard way of doing this ???
    If any all possible I would rather not use swing class because of its footprint and its slow performance over the net.

    Hi !
    Just in case anyone read this and is willing to comment on it...
    I have one BLOB and one CLOB column in the same record.
    I have been able to stream documents into and out of the BLOB's incl. MS .doc Also I have been able to get the content from BLOB and write it to a target directory.
    However I am having odd problems with CLOB, a simple text file. My servlet attempts to read the CLOB and does create the output file in the target directory, but does not copy the content over. It also returns 0 for clobLength !?! Here is the stub-code :
    ResultSet clobRS = thisStmt.executeQuery (
    "SELECT ATextMsg " +
    "FROM ... " +
    "WHERE ... " );
    clobRS.next();
    CLOB thisCLOB = ((OracleResultSet) clobRS).getCLOB("ATextMsg");
    int chunkSize = thisClob.getChunkSize();
    System.out.println("chunkSize is " + chunkSize); // default us 8132...
    char [] textBuffer = new char[chunkSize];
    String targetFile = targetDir + "retrieved_" + fileName;
    File thisFile = new File(targetFile); // it does create an empty target file...
    // read content as ASCII (text) content...
    FileOutputStream thisFileOutputStream = new FileOutputStream(thisFile);
    OutputStreamWriter thisWriter = new OutputStreamWriter(thisFileOutputStream);
    BufferedWriter thisBufferedWriter = new BufferedWriter(thisWriter);
    // things go wrong here, returns length of 0, why ?!?
    long clobLength = thisClob.length();
    System.out.println("clobLength is " + clobLength);
    // flush to targetFile - but since clobLength=0, nothing gets copied over...
    for (position=1; position<=clobLength; position+=chunkSize)
    int charsRead = thisClob.getChars(position, chunkSize, textBuffer);
    thisBufferedWriter.write(testBuffer);
    Since the clobLength is 0, obviously it will not copy from the database CLOB to the file.
    Manually change the clobLength = 8132, recompile and run, then it copies some junk to the targetFile, certainly not the textual data in the CLOB itself.
    The BLOB is fine...
    Can someone comment on this please and if possible, give me a hint on where I might have gone wrong with a simple text file ???

  • Table name reqd for batches and unrestricted stocks records

    Hi friends,
    I required table name of which having consolidated stocks with batch wise.
    ****reports avialable in T.Code:MMBE (here it displays the batches and unrestricted stocks by storage location wise)....
    These details,i want to see in tables.
    MCHA : will list only materials,plant and batche details.
    MARD: will display Storage location data for material with total quantity.
    LIke these, i want to view the table batches and unrestircted stock details of each material.
    Pls, post ur comments and answer as much as possible.
    Thanks & regards
    sankar.

    Got answered from other forum
    thanks

  • Batches and Serial numbers

    Hi,
    How can i create Batches and Serial numbers for a item in inventory in SAP B1

    Hi Sudha,
    One of my ckient he purchases Raw Material and converts it into finished good and he want to know the cost which occurs in the process of production and where he can see that in SAP B1 and after it is converted into Finished Good it takes some time to be sold and at that time where can he chek his inventory level .
    I think in SAP B1 if we enter a item as a raw material it will be shown as raw material till the time it is sold .
    Can u plz help me out in this how should i map his process in SAP B1 is that possible or not.
    Regards
    Naveen.G

  • Fields in MIGO - BATCH and Valuation Type

    Hi all,
    I would like to know the meaning of the following fields in MIGO.
    BATCH - Charg
    Valuation Type - Bwtar
    Which is the impact of each field?
    Should they have the same value in TRA MIGO?
    Which means that only the BATCH field is entered and the Valuation Type empty?
    Thanks you very much!!

    valuation type  comes into the game If a material is subject to split valuation.
    you can for example split the valuation based on origin, e.g. internal produced and external procured.
    this is more a financial thing.
    the batch is the level to segragate the stock of a material. e.g. each GR can be a new batch. so you can manage the stock by FIFO rules and by shelf life.  this is a logistics thing.
    Both can be used on their own, or together.
    if you want manage your materials by batches, but dont need split valuation, then you only have to take care about batch number, and the valuation type field in the batch record stays empty.
    if you manage material by batch and you use split valuation, then the split valuation type is a mandatory field in the batch record and you may have to enter batch and valuation type, but usually the valution type is defaulted from customizing.
    The tricky part is if you only use split valuation, because then the valuation type becomes the batch number. this is sometimes a bit confusing.

  • Defaulting batch and valuation type for a specific division for tcode me21n

    Hi
    I would like to default the valuation type and batch for a specific division while creating the PO.
    Kindly let me know if there is any user exit for this.
    Thanks & Regards
    Bhagya

    Hi .
    Actually my requirement is while you are creating PO, the value say 'ABC' must be defaulted both in Batch and valuation type  but when change that to 'DEF' it should allow you.. means you should be able to modify the batch and valuation type fields. I can be kept empty also.
    I tried using field exit to default Batch and valuation type, but it does not work if the batch is empty.
    If I use the BADI you mentioned what are import and export parameters and how do I code to meet my requirement.
    Kindly let me know.
    I will definitely reward points if it works.
    Thanks in advance
    Bhagya

Maybe you are looking for

  • External Hard Drive for use on PC and Mac

    I just purchased a SimpleTech external USB harddrive. I can copy files from both PC and MAC to it. However, --files transferred from PC are not visible to the MAC. --Files transferred from the MAC are visible by the PC, but when changed on PC the cha

  • Custom Windows and Frames in Java - Help

    Hello, I'm begining a Java class in school and Ive been wondering how to get rid of these boring windows. For example I want to turn something like this: to something like this: I realize theyre 2 different programs. Im simply asking how I may draw a

  • Installing os x 10.4 via cd problems

    I recently purchased a used iBook G3 on eBay and I acquired the cd version of osx tiger but when i try to install it gives me the error " mail cannot be installed on this computer. osx cannot be installed on this computer." I searched the forums here

  • How to undo the automatically start program to when a user logs on

    I have followed this following directions (http://technet.microsoft.com/en-us/library/cc736643%28v=ws.10%29.aspx#BKMK_TSC) : "Using Terminal Services Configuration Open Terminal Services Configuration. In the console tree, click Connections. In the d

  • Regain quality of images

    Dear All, I have some photos and DPI and SIZE of those photos has been decresed through Adobe Photoshop. I have to regain the original quality of all photos. Kindly help me out in this regard.