Handling blobs and timeouts
Hi,
What will happen if the database responds very slowly, while reading or inserting blob data from my java code.
Can this lead to a hang in my application or database in a multi user environment. How should I handle this sort of a situation with my java code or settings.
Do I have to set a timeout. Please guide me.
Thanking You,
Chamal.
Chamal,
i am assuming that your application is an application using the Swing framework and you mean with a hang in my application that the GUI freezes.
If so, have a look at: http://java.sun.com/developer/technicalArticles/javase/swingworker/
Regards, Marc
Similar Messages
-
Hi all,
Can anyone please tell me how to handle BLOB and CLOB using java? ie how to retrieve BLOB & CLOB data from the database?
Thanx in advance,
Regards,
ManiStarting with version 1.2 the ResultSet interrface manages BLOB and CLOB types: you can use the following methods:
resultSet.getBlob(int i)
resultSet.getClob(int i)
This is what you needed? -
Help required in handling of Oracle BLOB and CLOB in OC4J
Hi,
I am in a process of porting my application from Weblogic 6 to OC4J.
I have problem while handling CLob and Blob's in oracle. Weblogic has
classes defined to do the same. (weblogic.jdbc.common.OracleClob)
Does any one know how I can achieve this.
Thanks in advance.
Regards,
MoinWe have an application running on OC4J accessing an Oracle 8.1.7 db, and have no problems using BLOBs and CLOBs. It is explained quite clearly in the Oracle documentation.
If you require further assistance let me know :-) -
When attempting to delete a VHD's blob you may receive the following error:
There is currently a lease on the blob and no lease ID was specified in the request
While these errors are expected if a VHD is still registered as a disk or image in the portal, we have identified an issue where a lease remains even if the blob is not registered as a disk or image in the portal.
If you receive one of these errors, first make sure the VHD is not in use:
In the Windows Azure management portal, if the disk shows up under Virtual Machines,
Disks, and the Attached To column is not blank, you should first remove that VM in the
Attached To column by going to VM Instances, selecting the VM, then clicking
Delete.
If Attached To is blank, or the VM in the Attached To column was already removed, try removing the disk by highlighting it under
Disks and clicking Delete Disk (this will not physically delete the VHD from blob storage, it only removes the disk object in the portal). If you have multiple pages of disks it can be easier to search for a specific disk by
clicking the magnifying glass icon at the top right.
If Delete Disk is grayed out, or the disk is not listed under Disks, but you still cannot reuse it or delete it, review the options below.
Breaking the lease
You can use the
Lease Blob API to break the lease in this scenario, which is also available in the Windows Azure PowerShell assembly
Microsoft.WindowsAzure.StorageClient.dll using
LeaseAction Enumeration.
To use the BreakLease.ps1 script to break the lease:
Download Azure PowerShell by clicking Install under Windows here:
http://www.windowsazure.com/en-us/manage/downloads/
Start, Search, type Windows Azure PowerShell and open that console.
Run Get-AzurePublishSettingsFile to launch a browser window to
https://windows.azure.com/download/publishprofile.aspx to download the management certificate in a
.publishsettings file in order to manage your subscription with PowerShell.
Get-AzurePublishSettingsFile
Run Import-AzurePublishSettingsFile to import the certificate and subscription information. Replace the path below with the full path to the .publishsettings file if you didn't save it to your
Downloads folder. If you saved it to Downloads you can run it as-is, otherwise replace the path with the full path to the
.publishsettings file.
Import-AzurePublishSettingsfile $env:userprofile\downloads\*.publishsettings
Copy the script below into a text editor such as Notepad and save it as
BreakLease.ps1.
Run Set-ExecutionPolicy to allow script execution:
Set-ExecutionPolicy unrestricted
Run BreakLease.ps1 with the URL to the VHD in order to break the lease. The script obtains the necessary storage account information, checks that the blob is not currently registered as a disk or as an image, then proceeds to break the
current lease (if any).
Sample output:
BreakLease.ps1 -Uri 'http://clstorage.blob.core.windows.net/vhds/testvm1-testvm1-2012-06-26.vhd'
Processing http://clstorage.blob.core.windows.net/vhds/testvm1-testvm1-2012-06-26.vhd
Reading storage account information...
Confirmed - storage account 'clstorage'.
Checking whether the blob is currently registered as a disk or image...
Confirmed - the blob is not in use by the Windows Azure platform.
Inspecting the blob's lease status...
Current lease status: Locked
Unlocking the blob...
Current lease status: Unlocked
Success - the blob is unlocked.
BreakLease.ps1
Param([string]$Uri = $(Read-Host -prompt "Please specify a blob URL"))
$ProgressPreference = 'SilentlyContinue'
echo "Processing $Uri"
echo "Reading storage account information..."
$acct = Get-AzureStorageAccount | ? { (new-object System.Uri($_.Endpoints[0])).Host -eq (new-object System.Uri($Uri)).Host }
if(-not $acct) {
write-host "The supplied URL does not appear to correspond to a storage account associated with the current subscription." -foregroundcolor "red"
break
$acctKey = Get-AzureStorageKey ($acct.StorageAccountName)
$creds = "DefaultEndpointsProtocol=http;AccountName=$($acctKey.StorageAccountName);AccountKey=$($acctKey.Primary)"
$acctobj = [Microsoft.WindowsAzure.CloudStorageAccount]::Parse($creds)
$uri = $acctobj.Credentials.TransformUri($uri)
echo "Confirmed - storage account '$($acct.StorageAccountName)'."
$blobclient = New-Object Microsoft.WindowsAzure.StorageClient.CloudBlobClient($acctobj.BlobEndpoint, $acctobj.Credentials)
$blobclient.Timeout = (New-TimeSpan -Minutes 1)
$blob = New-Object Microsoft.WindowsAzure.StorageClient.CloudPageBlob($uri, $blobclient)
echo "Checking whether the blob is currently registered as a disk or image..."
$disk = Get-AzureDisk | ? { (new-object System.Uri($_.MediaLink)) -eq $blob.Uri }
if($disk) {
write-host "The blob is still registered as a disk with name '$($disk.DiskName)'. Please delete the disk first." -foregroundcolor "red"
break
$image = Get-AzureVMImage | ? { $_.MediaLink -eq $blob.Uri.AbsoluteUri }
if($image) {
write-host "The blob is still registered as an OS image with name '$($image.ImageName)'. Please delete the OS image first." -foregroundcolor "red"
break
echo "Confirmed - the blob is not in use by the Windows Azure platform."
echo "Inspecting the blob's lease status..."
try {
$blob.FetchAttributes()
} catch [System.Management.Automation.MethodInvocationException] {
write-host $_.Exception.InnerException.Message -foregroundcolor "red"
break
echo "Current lease status: $($blob.Properties.LeaseStatus)"
if($blob.Properties.LeaseStatus -ne [Microsoft.WindowsAzure.StorageClient.LeaseStatus]::Locked) {
write-host "Success - the blob is unlocked." -foregroundcolor "green"
break
echo "Unlocking the blob..."
$request = [Microsoft.WindowsAzure.StorageClient.Protocol.BlobRequest]::Lease($uri, 0, [Microsoft.WindowsAzure.StorageClient.Protocol.LeaseAction]::Break, $null)
$request.Timeout = $blobclient.Timeout.TotalMilliseconds
$acctobj.Credentials.SignRequest($request)
try {
$response = $request.GetResponse()
$response.Close()
catch {
write-host "The blob could not be unlocked:" -foregroundcolor "red"
write-host $_.Exception.InnerException.Message -foregroundcolor "red"
break
$blob.FetchAttributes()
echo "Current lease status: $($blob.Properties.LeaseStatus)"
write-host "Success - the blob is unlocked." -foregroundcolor "green"
Alternate method: make a copy of the VHD in order to reuse a VHD with a stuck lease
If you have removed the VM and the disk object but the lease remains and you need to reuse that VHD, you can make a copy of the VHD and use the copy for a new VM:
Download CloudXplorer. This will work with other
Windows Azure Storage Explorers but for the sake of brevity these steps will reference CloudXplorer.
In the Windows Azure management portal, select Storage on the left, select the storage account where the VHD resides that you want to reuse, select
Manage Keys at the bottom, and copy the Primary Access Key.
In CloudXplorer, go to File, Accounts,
New, Windows Azure Account and enter the storage account name in the
Name field and the primary access key in the Secret Key field. Leave the rest on the default settings.
Expand the storage account in the left pane in CloudXplorer and select the
vhds container (or if the VHD in question is one uploaded to a different location, browse to that location instead).
Right-click the VHD you want to reuse (which currently has a stuck lease), select
Rename, and give it a different name. This will throw the error
could not rename…there is currently a lease on the blob… but click
Yes to continue, then View, Refresh (F5) to refresh and you will see it did make a copy of the VHD since it could not rename the original.
In the Azure management portal, select Virtual Machines,
Disks, then Create Disk at the bottom.
Specify a name for the disk, click the folder icon under VHD URL to browse to the copy of the VHD you just created, check the box for
This VHD contains an operating system, select the drop-down to specify if it is
Windows or Linux, then click the arrow at the bottom right to create the disk.
After the portal shows Successfully created disk <diskname>, select
New at the bottom left of the portal, then Virtual Machine,
From Gallery, My Disks, and select the disk you just created, then proceed through the rest of the wizard to create the VM.
Thanks,
CraigJust to add an update to this, it looks like the namespaces have changed with the latest version of the SDK. I have updated the script to use the new namespaces, namely: Microsoft.WindowsAzure.Storage.Blob.CloudPageBlob and Microsoft.WindowsAzure.Storage.CloudStorageAccount.
Param([string]$Uri = $(Read-Host -prompt "Please specify a blob URL"))
$ProgressPreference = 'SilentlyContinue'
echo "Processing $Uri"
echo "Reading storage account information..."
$acct = Get-AzureStorageAccount | ? { (new-object System.Uri($_.Endpoints[0])).Host -eq (new-object System.Uri($Uri)).Host }
if(-not $acct) {
write-host "The supplied URL does not appear to correspond to a storage account associated with the current subscription." -foregroundcolor "red"
break
$acctKey = Get-AzureStorageKey ($acct.StorageAccountName)
$creds = "DefaultEndpointsProtocol=http;AccountName=$($acctKey.StorageAccountName);AccountKey=$($acctKey.Primary)"
$acctobj = [Microsoft.WindowsAzure.Storage.CloudStorageAccount]::Parse($creds)
$uri = $acctobj.Credentials.TransformUri($uri)
echo "Confirmed - storage account '$($acct.StorageAccountName)'."
$blob = New-Object Microsoft.WindowsAzure.Storage.Blob.CloudPageBlob($uri, $creds)
echo "Checking whether the blob is currently registered as a disk or image..."
$disk = Get-AzureDisk | ? { (new-object System.Uri($_.MediaLink)) -eq $blob.Uri }
if($disk) {
write-host "The blob is still registered as a disk with name '$($disk.DiskName)'. Please delete the disk first." -foregroundcolor "red"
break
$image = Get-AzureVMImage | ? { $_.MediaLink -eq $blob.Uri.AbsoluteUri }
if($image) {
write-host "The blob is still registered as an OS image with name '$($image.ImageName)'. Please delete the OS image first." -foregroundcolor "red"
break
echo "Confirmed - the blob is not in use by the Windows Azure platform."
echo "Inspecting the blob's lease status..."
try {
$blob.FetchAttributes()
} catch [System.Management.Automation.MethodInvocationException] {
write-host $_.Exception.InnerException.Message -foregroundcolor "red"
break
echo "Current lease status: $($blob.Properties.LeaseStatus)"
if($blob.Properties.LeaseStatus -ne [Microsoft.WindowsAzure.Storage.StorageClient.LeaseStatus]::Locked) {
write-host "Success - the blob is unlocked." -foregroundcolor "green"
break
echo "Unlocking the blob..."
$request = [Microsoft.WindowsAzure.Storage.StorageClient.Protocol.BlobRequest]::Lease($uri, 0, [Microsoft.WindowsAzure.Storage.StorageClient.Protocol.LeaseAction]::Break, $null)
$request.Timeout = $blobclient.Timeout.TotalMilliseconds
$acctobj.Credentials.SignRequest($request)
try {
$response = $request.GetResponse()
$response.Close()
catch {
write-host "The blob could not be unlocked:" -foregroundcolor "red"
write-host $_.Exception.InnerException.Message -foregroundcolor "red"
break
$blob.FetchAttributes()
echo "Current lease status: $($blob.Properties.LeaseStatus)"
write-host "Success - the blob is unlocked." -foregroundcolor "green" -
How to handle BLOB field in receiver JDBC adapter into ABAP table
Dear Experts,
I am working in a synchronous scenario with Sender ABAP Proxy to Oracle Database as receiver via SAP PO 7.4.I will be calling a stored procedure view with fields ID, NAME,Age,*** and BLOB (Image binary).
1. The response from Oracle Database field BLOB is to be stored in ABAP table.Would I have to write any JAVA program to read the BLOB or the receiver JDBC adapter will handle it and store in a table by using ABAP proxy once it reaches ECC.
2. If yes, would the JAVA program have to deal with other 4 fields.
3. Can I use a UDF mapping to this BLOB field.
Regards
Rebecca...Dear Praveen,
Thanks for your response...
Please correct me if I am wrong.
1. For 1-1 response mapping for BLOB field, I will use just use the below UDF code.
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i+1), 16));
return data;
2. ===Using the byte data, create binary attachment in mapping for abap proxy response===
Could you please share how to create the binary attachment.. I am not clear
Regards... -
Uploading PDF in to BLOB and Retrieve PDF from BLOB
hi
I have recently started working in apex and run into a bump while trying to handle PDF file Attachments and BLOBs.
I am trying to upload a PDF file into BLOB database Column using APEX, and later view this file from DB.
I require assistance on how to upload PDF file into BLOB, and how i can later view this inside the browser window, using APEX
thanksMaybe this blog post can help you.
Regards,
Sergio -
How to handle blob/clob?
In my process I can successfully write to a blob or clob field (via database adapter). But I'm not able anymore to get the value out of the database (Oracle Lite). I always get following error:
<remoteFault xmlns="http://schemas.oracle.com/bpel/extension">
<part name="code">
<code>0</code>
</part>
<part name="summary">
<summary>file:/E:/OraBPELPM_1/integration/orabpel/domains/default/tmp/.bpel_GetStatus_1.0.jar/SelectJobStates.wsdl [ SelectJobStates_ptt::SelectJobStatesSelect_key_typeFrom_typeTo(SelectJobStatesSelect_key_typeFrom_typeTo_inparameters,MainCollection) ] - WSIF JCA Execute of operation 'SelectJobStatesSelect_key_typeFrom_typeTo' failed due to: Exception: Nicht erfolgreiche Ausführung von DBReadInteractionSpec. Abfragename: [SelectJobStatesSelect], Descriptor-Name: [GetStatus.Main]. ; nested exception is: ORABPEL-11614 Exception: Nicht erfolgreiche Ausführung von DBReadInteractionSpec. Abfragename: [SelectJobStatesSelect], Descriptor-Name: [GetStatus.Main]. Weitere Informationen finden Sie in der Root Exception. Verursacht von Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException Exception-Beschreibung: java.sql.SQLException: Internal Error:LiteThinJDBCLob: One or More Invalid Handle(s) Interne Exception: java.sql.SQLException: Internal Error:LiteThinJDBCLob: One or More Invalid Handle(s) Fehlercode:0.</summary>
</part>
<part name="detail">
<detail>Exception-Beschreibung: java.sql.SQLException: Internal Error:LiteThinJDBCLob: One or More Invalid Handle(s) Interne Exception: java.sql.SQLException: Internal Error:LiteThinJDBCLob: One or More Invalid Handle(s) Fehlercode:0</detail>
</part>
</remoteFault>
Trying on the console with a polsql skript I got the following:
[POL-3006] null handle is not allowed
Any ideas?
Yves
PS. Is there a GUI client which can browse data on a Oracle Lite database?Hi Pete,
The problem is with using Oracle's CLOB and BLOB implementation. I haven't even started using BLOB and CLOB. I want to collect data of BLOB and CLOB types from oracle and store it in XML file and after that if required, collect the same data from xml file and store it back to oracle table. I can do these things for all the rest datatypes but BLOB and CLOB. How to proceed?
Thanks -
Samit -
Hi,
is there a detailed example how to handle Blob's with CMP Beans?
I'm trying to store some images in a database (Oracle 9i) using CMP Beans and Oracle iAS 9.03 and jdk 1.4.
Thanks in advance
JensWe are currently developing a How-To on this and will put this on OTN.
1) Code snippet from Bean Class:
public abstract byte[] getPicture();
public abstract void setPicture(byte[] newPicture);
public Long ejbCreate(Long empno, byte[] newPicture)
setEmpno(empno);
setPicture(newPicture);
return empno;
public void ejbPostCreate(Long empno, byte[] newPicture)
2) Mapping in the orion-ejb-jar.xml:
<entity-deployment name="EmployeePicture" data-source="jdbc/OracleDS" table="EMPPIC">
<primkey-mapping>
<cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(8)"/>
</primkey-mapping>
<cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(8)"/>
<cmp-field-mapping name="picture" persistence-name="PICTURE" persistence-type="BLOB(4000)"/>
</entity-deployment>
3) Create the client to create the bean:
Long empNo =(Long) Long.valueOf(request.getParameter("EmpNo"));
String fileName =request.getParameter("ImageFileName");
InputStream is = new BufferedInputStream(new FileInputStream(fileName));
int len;
// Initialize byte array
byte byteValue[] = new byte[2048000];
len = is.read(byteValue);
EmployeePictureLocal employeePicture = empHome.create(empNo , byteValue);
out.println("Picture of Emp#:"+empNo +" successfully Loaded into DB <br> <br>");
4) Code snippet to view the image :
Long empNo =(Long) Long.valueOf(request.getParameter("EmpNo"));
out.println("Picture of Emp#"+empNo);
EmployeePictureLocal emp = empHome.findByPrimaryKey(empNo);
response.setContentType("image/jpeg");
OutputStream os = null;
os = response.getOutputStream() ;
byte[] pic = emp.getPicture();
os.write(pic);
os.close();
os = null;
Let me know if this helps
thanks
Debu -
Help Please: working with HTML BLOBS and workflow attachments
simply put need to be able to:
1. create html document using plsql and store as BLOB in a table.
2. retrieve this BLOB and send as Document Attachment in workflow notification.
This sounds so simple to be able to do and yet I've spent the past week trying to find easy to understand documentation on how to do this.
The html i'm creating is too large for just the normal 32K (I believe) buffer for a regular (text) document attachment. If i limit the # of rows returned, I can use this method just fine. However, my assumption is that with the amount of data I need to return in the attachment is that the BLOB type is what i will need to be able to accomplish this.
I would be more than happy to e-mail anyone samples of the workflow and code I am currently using to attempt this.
Lastly, one of the main articles I've looked at is this:
http://oracle.anilpassi.com/index2.php?option=com_content&do_pdf=1&id=22
In my latest attempt, i picked an html file currently stored in fnd_lobs and tried to send the file as an attachment.
wf_engine.setitemattrdocument ( itemtype => c_itemtype,
itemkey => l_itemkey,
aname => 'LOB_DOCUMENT',
documentid =>'PLSQLBLOB:DANA_RLM_EXCEPTION_NOTIFY.xx_notif_attach_procedure/' || to_char(75871));
I get the following error in Workflow when trying to open the attached document:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
Any help would be greatly appreciated... would consider naming our next child after you. ;)I had done some work trying to see how Lotus Notes handles HTML content.. to my dismay, Lotus Notes does not even handle some of the basic HTML correctly.. leave alone the embedded OA Fwk content in the workflow e-mail notifications.
This seems to be a bug in Lotus notes.. I don't have the link to the IBM site that talks abt the bug. Will post it once I have it. -
How can i handle BLOB data.
Thank you for the input, but it wasn't so usefull. I found a soluten to get the get a blob from the database.
<snip>
MimeBodyPart mbp = new MimeBodyPart();
// Create the Multipart to be added the parts to
Multipart mp = new MimeMultipart();
while( rs.next()) {
BLOB Attachment = rs.getBLOB("att");
String FileName = rs.getString("nam");
String FileType = rs.getString("ext");
// Create and fill the second message part (Attachements)
MimeBodyPart mbp1 = new MimeBodyPart();
String type = (FileType != null ? FileType : dftMime);
String fileName = (FileName != null ? FileName : dftName);
mbp1.setDisposition(Part.ATTACHMENT);
mbp1.setFileName(fileName);
mbp1.setDataHandler(new
DataHandler(new BLOBDataSource(Attachment, type)));
mbp1.setHeader( "Content-Transfer-Encoding", "base64" );
mp.addBodyPart(mbp1);
Now i get the following stacktrace:
A send error is occured. Exit program.null
javax.mail.internet.ParseException
at javax.mail.internet.ContentType.<init>(ContentType.java:89)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
at javax.mail.Transport.send(Transport.java:97)
at miag.app.mail.SendMail.send(SendMail.java:150)
at miag.app.mail.SendMail.main(SendMail.java:37)
The email will not be sent.
Thank you
Rene -
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
thanksCheck this out, hopefully it'll help you
http://oraclebizint.wordpress.com/2007/11/12/oracle-bi-ee-101332-working-with-clob-fields/
Fiston -
Reading the Blob and writing it to an external file in an xml tree format
Hi,
We have a table by name clarity_response_log and content of the column(Response_file) is BLOB and we have xml file or xml content in that column. Most probably the column or table may be having more than 5 records and hence we need to read the corresponding blob content and write to an external file.
CREATE TABLE CLARITY_RESPONSE_LOG
REQUEST_CODE NUMBER,
RESPONSE_FILE BLOB,
DATE_CRATED DATE NOT NULL,
CREATED_BY NUMBER NOT NULL,
UPDATED_BY NUMBER DEFAULT 1,
DATE_UPDATED VARCHAR2(20 BYTE) DEFAULT SYSDATE
)The xml content in the insert statement is very small because of some reason and cannot be made public and indeed we have a very big xml file stored in the BLOB column or Response_File column
Insert into CLARITY_RESPONSE_LOG
(REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
Values
(5, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
Insert into CLARITY_RESPONSE_LOG
(REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
Values
(6, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
Insert into CLARITY_RESPONSE_LOG
(REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
Values
(7, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
Insert into CLARITY_RESPONSE_LOG
(REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
Values
(8, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');
Insert into CLARITY_RESPONSE_LOG
(REQUEST_CODE, RESPONSE_FILE, DATE_CRATED, CREATED_BY, UPDATED_BY, DATE_UPDATED)
Values
(9, '<?xml version="1.0" encoding="UTF-8"?><xml-response><phone-number>1212121212</tracking-number></xml-response>', TO_DATE('09/23/2010 09:01:34', 'MM/DD/YYYY HH24:MI:SS'), 1, 1, '23-SEP-10');THe corresponding proc for reading the data and writing the data to an external file goes something like this
SET serveroutput ON
DECLARE
vstart NUMBER := 1;
bytelen NUMBER := 32000;
len NUMBER;
my_vr RAW (32000);
x NUMBER;
l_output UTL_FILE.FILE_TYPE;
BEGIN
-- define output directory
l_output :=
UTL_FILE.FOPEN ('CWFSTORE_RESPONCE_XML', 'extract500.txt', 'wb', 32760);
vstart := 1;
bytelen := 32000;
---get the Blob locator
FOR rec IN (SELECT response_file vblob
FROM clarity_response_log
WHERE TRUNC (date_crated) = TRUNC (SYSDATE - 1))
LOOP
--get length of the blob
len := DBMS_LOB.getlength (rec.vblob);
DBMS_OUTPUT.PUT_LINE (len);
x := len;
---- If small enough for a single write
IF len < 32760
THEN
UTL_FILE.put_raw (l_output, rec.vblob);
UTL_FILE.FFLUSH (l_output);
ELSE
-------- write in pieces
vstart := 1;
WHILE vstart < len AND bytelen > 0
LOOP
DBMS_LOB.READ (rec.vblob, bytelen, vstart, my_vr);
UTL_FILE.put_raw (l_output, my_vr);
UTL_FILE.FFLUSH (l_output);
---------------- set the start position for the next cut
vstart := vstart + bytelen;
---------- set the end position if less than 32000 bytes
x := x - bytelen;
IF x < 32000
THEN
bytelen := x;
END IF;
UTL_FILE.NEW_LINE (l_output);
END LOOP;
----------------- --- UTL_FILE.NEW_LINE(l_output);
END IF;
END LOOP;
UTL_FILE.FCLOSE (l_output);
END;The above code works well and all the records or xml contents are being written simultaneously adjacent to each other but we each records must be written to a new line or there must be a line gap or a blank line between any two records
the code which I get is as follow all all xml data comes on a single line
<?xml version="1.0" encoding="ISO-8859-1"?><emp><empno>7369</empno><ename>James</ename><job>Manager</job><salary>1000</salary></emp><?xml version="1.0" encoding="ISO-8859-1"?><emp><empno>7370</empno><ename>charles</ename><job>President</job><salary>500</salary></emp>But the code written to an external file has to be something like this.
<?xml version="1.0" encoding="ISO-8859-1"?>
<emp>
<empno>7369</empno>
<ename>James</ename>
<job>Manager</job>
<salary>1000</salary>
</emp>
<?xml version="1.0" encoding="ISO-8859-1"?>
<emp>
<empno>7370</empno>
<ename>charles</ename>
<job>President</job>
<salary>500</salary>
</emp>Please adviceWhat was wrong with the previous answers given on your other thread:
Export Blob data to text file(-29285-ORA-29285: file write error)
If there's a continuing issue, stay with the same thread, don't just ask the same question again and again, it's really Pi**es people off and causes confusion as not everyone will be familiar with what answers you've already had. You're just wasting people's time by doing that.
As already mentioned before, convert your BLOB to a CLOB and then to XMLTYPE where it can be treated as XML and written out to file in a variety of ways including the way I showed you on the other thread.
You really seem to be struggling to get the worst possible way to work. -
How to create a table with datatype blob and insert a pdf file (ravi)
how to create a table with datatype blob and insert a pdf file,
give me the explain asap
1.create the table?
2.insert the pdffiles into tables?
3.how to view the files?
Thanks & Regards
ravikumar.k
Edited by: 895044 on Dec 5, 2011 2:55 AM895044 wrote:
how to create a table with datatype blob and insert a pdf file,
give me the explain asapPerhaps you should read...
{message:id=9360002}
especially point 2.
We're not just sitting here waiting to answer your question as quickly as possible for you. -
To store PDF into BLOB and retrieve into OLE/OCX
We would like to:
1. Store a PDF file (output of a report saved in file server) into a BLOB
column.
2. Retrieve previously stored PDF in the BLOB column and display using either
OLE automation or ActiveX (OCX) control.
I read all related documents in metalink that addresses this issue however cant
get this to work. We have Acrobat Reader 4.0. Here are some issues from the
tests that I did:
1. To load the PDF file the program code that uses BFILE and LOADFROMFILE does
not work since the database is on a remote server and the PDF file is on a
local file server. The DIRECTORY created on the database is unable to find the
PDF file.
2. Though I want the loading of the file to be programmatic, I tried
right-click on the OLE container and inserted object from file. This loaded the
file into the container (Icon on the container appeared) however I was not able
to view the document by double-clicking. An error in Adobe occured: 'There was
an error opening this document. A file read error occured'. My guess is the
'Insert Object' did not insert the file properly into the BLOB.
3. When trying to display the PDF file stored in file server (in case storing
into BLOB does not work), I used an OCX control, right-clicked and Insert
Object and select Adobe Control for ActiveX. The problem here is when I run the
form, the OCX control shows up empty and I have to 'Insert Object' again in
runtime. Once I manually insert object from runtime the GET_INTERFACE POINTER &
SET_PROPERTY works fine is displaying the document. Is there any way to
maintain the control property of the OCX when the form is run?
4. Are there any workarounds and better solution to store PDFs into BLOBs and
retrieve and display in OLE/OCX controls? Using temporary file into local drive
is not an issue.
5. Would I be able to make use of 'PDF.PdfCtrl.1' OLE class?
6. Does OLE automation work for Acrobat Reader 4.0.?
I would appreciate all the help.
ShyamIm facing a similar kind of problem. I want to store and retrieve Office files, PDF and Jpegs into/from the database to view them on web in disconnected mode. Please reply as I cant find any help/documentation regarding saving BLOB data into files. I was able to store file data into BLOB, using DBMS_LOB package.
Shahzad -
Handling Units and BADI_HU_AUTOPACK
We are setting up handling units(HU's) to be created at the time of Transfer Order(TO) creation. We have implemented the badi BADI_HU_AUTOPACK. What I am looking for is the way to link the handling unit number with the line items on the TO so that when the user goes to confirm the transfer order the HU's and the line items are aligned as desired. In the CT_ITEMS parameter I can see the handling units and the TO item data, but the hadling unit number has not yet been created. I would appreciate any input on this issue.
Those fields are filled. The HU is field EXIDV below, and the $0000000001 is like a placeholder, since the HU number has not yet been generated. My assumption was that this number to be created would be linked with the TO Item 000001. This is not the case when viewing the TO.
VENUM C 10
EXIDV C 20 $0000000001
VELIN C 1 1
BELNR C 10 1001003116
POSNR N 6 000001
SUB_HU_VENUM C 10
SUB_HU_EXIDV C 20
Maybe you are looking for
-
Changing LDAP System from AD to ADAM in CUCM 7.1.5
Hello Guys, First time poster here, so be gentle... We have a query regarding LDAP Synchronisation in CUCM 7.1.5. A brief background : Our CUCM environment has expanded since we first put it in a couple of years ago. We originally had, and continue t
-
Preview is different web browser
anyone have encounter when you want to preview your work and somehow it is different in the web broswer.... Example image are in different location
-
Applications not longer install on UDI Deployment after R2 upgrade
Hey guys, Seem to have an issue here. In 2012 SP1, my task sequences were working great, and UDI was installing all the selected applications. After the R2 upgrade, I re-built my task sequences and boot images, but now the OSD sequence doesn't inst
-
I'm using Big date theme but the numbers on the date is cut off on top. I'm on iphoto 11 and OS 10.8.2. anyone else having this issue??
-
Want to upgrade to newest version, want to upgrade to newest version
what do i need to do to upgrade my powerbook G4 from Mac Os 9.2 to the newest version mac has to offer