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 advice

What 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.

Similar Messages

  • Problem on reading and writing from from a *.txt file

    I get Problem on reading and writing from from a *.txt file. The following is the read() method...
    The software said the DataInputStream is depreciated. Can anyone help me please?
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        String str = "";
        try
          in = new BufferedReader(file);
          //in = new FileInputStream(file);
          for(;;)
            str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);
      }

    Thank you for your reply. I have made some change. However, there is an incompetable type found error.
    in = new BufferedReader(new InputStreamReader(in));The following are all of the code.
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        //BufferedReader in = null;
        String str = "";
        try
          in = new BufferedReader(new InputStreamReader(in));
          //in = new FileInputStream(file);
          for(;;)
            BufferedReader Bstr = new BufferedReader(new InputStreamReader(in));
            //str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);

  • Error deleting VHD: There is currently a lease on the blob and no lease ID was specified in the request

    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,
    Craig

    Just 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"

  • I have just used air display with macbook pro. i have disconnected now from apple tv. but my laptop screen is still very small like its connected to the tv. this means all the tabs and writing is very small, how do i full disconnect my laptop?

    i have just used air display with macbook pro. i have disconnected now from apple tv. but my laptop screen is still very small like its connected to the tv. this means all the tabs and writing is very small. like the display down the bottom where al the applications are, is n the middle of the page and not spread down the bottom. this is seriously annoying! all the writing is every small and the tabs are small and its hard to read.  the air display link has disappeared from my computer. but the laptop screen is still very small. i want to know how do i get rid of this and return my macbook screen to its normal size. thank you

    Hello chrispyw,
    If your content is still being displayed incorrectly, I would check the resolution setting for the built in display with this article:
    OS X Yosemite: Adjust your display’s resolution
    If it keeps happening whenever you use AirPlay then I would use this section of the following article to reset the display system:
    Apple computers: Troubleshooting issues with video on internal or external displays
    Reset the system
    You can reset the Mac's parameter RAM and SMC.Reset the resolution
    Start by resetting the Mac's parameter RAM. If the display does not come up, was previously set to an unsupported resolution, and still results in no video:
    Start up in Safe Mode.
    From the Apple () menu, choose System Preferences.
    Choose Displays from the View menu to open the preferences pane.
    Select any resolution and refresh rate that your display supports.
    Restart your computer.
    Thank you for using Apple Support Communities.
    Regards,
    Sterling

  • How to read from BLOB and Write to a file in user readable format.

    Hi,
         I am trying to read from a BLOB column and write the content to a file in user readable format. So far I was able to read the Blob column using dbms_lob, but not able to write to a file. Kindly let me know the method to do this.

    Hi, with this Java Code from Oracle Technet it's a easy thing:
    // classpath= /ORACLE/u01/app/oracle/product/10.2.0.3/jdbc/lib/ojdbc14.jar
    // Java SQL classes
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    // Oracle JDBC driver class
    import oracle.jdbc.OracleDriver;
    // Java IO classes
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    //Java Util classes
    import java.util.Properties;
    * This class demonstrates the Oracle JDBC 10g enhanced features for inserting
    * and retrieving CLOB data from the database. Using the new features, large
    * data of more than 32765 bytes can be inserted into the database using the
    * existing PreparedStatement.setString() and PreparedStatement.getString()
    * methods.
    public class ClobMan {
    /* Database Connection object */
    private Connection conn = null;
    /* Variables to hold database details */
    private String url = null;
    private String user = null;
    private String password = null;
    // Create a property object to hold the username, password and
    // the new property SetBigStringTryClob.
    private Properties props = new Properties();
    /* String to hold file name */
    private String fileName = null;
    * Default Constructor to instantiate and get a handle to class methods
    * and variables.
    public ClobMan(String fileName) {
    this.fileName = fileName;
    * Main runnable class.
    public static void main(String[] args) throws SQLException {
    // Instantiate the main class.
    ClobMan clobMan = new ClobMan(args[0]);
    // Load the Oracle JDBC driver class.
    DriverManager.registerDriver(new OracleDriver());
    // Load the database details into the variables.
    String dbUrl = "jdbc:oracle:thin:@pmol:1550:dbpmol";
    clobMan.url = dbUrl;
    clobMan.user = "gh10";
    clobMan.password = "secret";
    // Populate the property object to hold the username, password and
    // the new property 'SetBigStringTryClob' which is set to true. Setting
    // this property allows inserting of large data using the existing
    // setString() method, to a CLOB column in the database.
    clobMan.props.put("user", clobMan.user );
    clobMan.props.put("password", clobMan.password);
    clobMan.props.put("SetBigStringTryClob", "true");
    // Check if the table 'CLOB_TAB' is present in the database.
    //clobMan.checkTables();
    // Call the methods to insert and select CLOB from the database.
    //clobMan.insertClob();
    clobMan.selectClob();
    * This method will insert the data into a CLOB column in the database.
    * Oracle JDBC 10g has enhanced the existing PreparedStatement.setString()
    * method for setting the data more than 32765 bytes. So, using setString(),
    * it is now easy to insert CLOB data into the database directly.
    private void insertClob() throws SQLException {
    // Create a PreparedStatement object.
    PreparedStatement pstmt = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create SQL query to insert data into the CLOB column in the database.
    String sql = "INSERT INTO clob_tab VALUES(?)";
    // Read a big file(larger than 32765 bytes)
    String str = this.readFile();
    // Create the OraclePreparedStatement object
    pstmt = conn.prepareStatement(sql);
    // Use the same setString() method which is enhanced to insert
    // the CLOB data. The string data is automatically transformed into a
    // clob and inserted into the database column. Make sure that the
    // Connection property - 'SetBigStringTryClob' is set to true for
    // the insert to happen.
    pstmt.setString(1,str);
    // Execute the PreparedStatement
    pstmt.executeUpdate();
    } catch (SQLException sqlex) {
    // Catch Exceptions and display messages accordingly.
    System.out.println("SQLException while connecting and inserting into " +
    "the database table: " + sqlex.toString());
    } catch (Exception ex) {
    System.out.println("Exception while connecting and inserting into the" +
    " database table: " + ex.toString());
    } finally {
    // Close the Statement and the connection objects.
    if (pstmt!=null) pstmt.close();
    if (conn!=null) conn.close();
    * This method reads the CLOB data from the database by using getString()
    * method.
    private void selectClob() throws SQLException {
    // Create a PreparedStatement object
    PreparedStatement pstmt = null;
    // Create a ResultSet to hold the records retrieved.
    ResultSet rset = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create SQL query statement to retrieve records having CLOB data from
    // the database.
    String sqlCall = "SELECT rownum, name, sourcetext FROM t_source";
    pstmt= conn.prepareStatement(sqlCall);
    // Execute the PrepareStatement
    rset = pstmt.executeQuery();
    String rownum = null;
    String o_name =null;
    String clobVal = null;
    // Get the CLOB value from the resultset
    //java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter("pr_all.sql"));
    while (rset.next()) {
    rownum = rset.getString(1);
         o_name = rset.getString(2);
         clobVal = rset.getString(3);
    System.out.println(" length: "+clobVal.length()+" "+o_name+" "+rownum);
         java.io.BufferedWriter out =
         new java.io.BufferedWriter(new java.io.FileWriter(o_name+".prc"));
         out.write(clobVal);
         out.newLine();
         out.write("/");
         out.newLine();
         out.newLine();
    out.flush();
    out.close();
    } catch (SQLException sqlex) {
    // Catch Exceptions and display messages accordingly.
    System.out.println("SQLException while connecting and querying the " +
    "database table: " + sqlex.toString());
    } catch (Exception ex) {
    System.out.println("Exception while connecting and querying the " +
    "database table: " + ex.toString());
    } finally {
    // Close the resultset, statement and the connection objects.
    if (rset !=null) rset.close();
    if (pstmt!=null) pstmt.close();
    if (conn!=null) conn.close();
    * Method to check if the table ('CLOB_TAB') exists in the database; if not
    * then it is created.
    * Table Name: CLOB_TAB
    * Column Name Type
    * col_col CLOB
    private void checkTables() {
    Statement stmt = null;
    ResultSet rset = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create Statement object
    stmt = conn.createStatement();
    // Check if the table is present
    rset = stmt.executeQuery(" SELECT table_name FROM user_tables "+
    " WHERE table_name = 'CLOB_TAB' ");
    // If the table is not present, then create the table.
    if (!rset.next()) {
    // Table does not exist, create it
    stmt.executeUpdate(" CREATE TABLE clob_tab(clob_col CLOB)");
    } catch (SQLException sqlEx) {
    System.out.println("Could not create table clob_tab : "
    +sqlEx.toString());
    } finally {
    try {
    if( rset != null ) rset.close();
    if( stmt != null ) stmt.close();
    if (conn!=null) conn.close();
    } catch(SQLException ex) {
    System.out.println("Could not close objects in checkTables method : "
    +ex.toString());
    * This method reads the specified text file and, returns the content
    * as a string.
    private String readFile()
    throws FileNotFoundException, IOException{
    // Read the file whose content has to be passed as String
    BufferedReader br = new BufferedReader(new FileReader(fileName));
    String nextLine = "";
    StringBuffer sb = new StringBuffer();
    while ((nextLine = br.readLine()) != null) {
    sb.append(nextLine);
    // Convert the content into to a string
    String clobData = sb.toString();
    // Return the data.
    return clobData;
    }

  • Error when trying to remove blob: There is currently a lease on the blob and no lease ID was specified in the request.

    I'm having this error when I try to remove a blob that was used for a VM in the pass, the VM was already removed and there's nothing using that blob nor even the storage account wh ere the blob is stored.
    There is currently a lease on the blob and no lease ID was specified in the request. RequestId:0a441667-0001-0044-7861-bc17ef000000 Time:2014-12-18T15:53:04.5315752Z
    I'm trying to delete the blob from the current web interface, and I haven't found a way to specify a lease ID or check what lease could it has.
    Thanks in advance

    Hi  jruiz,
    When you delete a Virtual Machine on the Management Portal, the "Disk" resource used to mount the Virtual Machines VHD is kept.The "Disk" resource is responsible for mounting the blob for the VHD file, so it can be attached to virtual
    machines as an OS Disk or Data Disk. It will continue to hold a lease on the blob for as long as it exists.
    So you need to delete the "Disk" resource to break the lease on the blob.
    Please refer to the link about how to delete disk resource to break lease on the blob.
    http://blogs.msdn.com/b/mast/archive/2013/02/05/iaas-unable-to-delete-vhd-there-is-currently-a-lease-on-the-blob.aspx
    Best Regards,
    Kevin Shen.

  • Hi. I use Adobe Acrobat XI pro to make a PDF ebook embedded with audio. It works really well on my computer-I can read the book and hear the auto play mp3. The problem is, when I send it to my customers, they have difficulty hearing the audio. A few of th

    Hi. I use Adobe Acrobat XI pro to make a PDF ebook embedded with audio. It works really well on my computer-I can read the book and hear the auto play mp3. The problem is, when I send it to my customers, they have difficulty hearing the audio. A few of them say they have Flash player on their PC and somehow they still can't hear, some say their Google Chrome browser tells them they've already got one flash player while they try to download one. For me, I had to download two versions of Flash player to be able to access to the audio. I don't know what the problem is, is it because it's the latest version of Adobe Acrobat XI pro that people with older version of Adobe reader or flash player can't open it properly? Or is it something else? How can I make sure every customer with different system can access to my books? Hope to hear from you ASAP! Thank you very much.

    And how are the customers accessing the PDFs?
    What devices are they using?
    What program or apps with versions are they using?
    I this age of other then PDF eBooks formats and reader program and apss for computers and mobile devices for these formats I would look at creating the books in one or more of the eBook formats.
    Google Chrome and FireFox both have their own version of a PDF reader plug-in and they are well known to be less capable than Adobe Reader. It is possible to configure these products to use Adobe Reader.

  • How do I send an iMessage, a step by step answer. I have read the manual and it doesnt explain how

    Can someone explain how you send an iMessage. I know how to send texts and emails but I only want to use the iMessage so that my company bill doesnt show text numbers called. I have got iMessage turned on in settings. I have read the manual and it says you can do it but it doesnt say how.

    Thanks for your response. It helps a little. I now dont know how to change the send button from green to blue. What determines how the message is sent?
    I know in the settings I can turn off "send as sms" so that should stop text messages being sent. I went through my contact list and selected a few people at random and noticed the send button was green for some and blue for others so I am thinking it may be either something they do to let me iMessage them or it is something I have to do in my contact list.
    Do you know?

  • I am trying to send photos to the cloud from my phone to my iPad but they are not appearing in the stream. I have read the instructions and I think I am doing it right or am I missing a part of the process?

    I am trying to send photos to the cloud from my phone to my iPad but they are not appearing in the stream. I have read the instructions and I think I am doing it right or am I missing a part of the process?

    HI,
    Have you done this before ? And if so, is photo stream turned on on your iphone and ipad. and as Alfred DeRose pointed out they must both on the same icloud account.
    If you're new to this, you might want to do some research. Photo stream is different from camera roll and albums. Many have been on this sight looking for their photos stored in icloud after restore, etc. and they're not there. Also, after thirty days icloud deletes your photos from photo stream.
    So if you're not aware, you might want to google your question. We're using the camera connection kit soon and I am learning about it. From all I've read, I'm also not the biggest icloud fan. I use dropbox. We plan to put photos taken on ipad with a camera/iphones into albums on the ipad. We'll keep all on the sd card until (and after) they can be uploaded to a computer.
    An example of an article we can learn from -
    http://www.macobserver.com/tmo/article/how-to-understand-and-work-with-your-iclo ud-photo-stream
    Hope this helps.

  • Has had 2 iTunes gift cards and the scratch off strip on the back leaves us unable to read the numbers and we can not retrive anysongs without the correct numbers and letters. What can we do? Please help...

    Has had 2 iTunes gift cards and the scratch off strip on the back leaves us unable to read the numbers and we can not retrive any songs without the correct numbers and letters. What can we do? Please help...

    iTunes Store: Invalid, inactive, or illegible codes

  • Is there a DJ app for the Ipad that will read the "start" and "stop time" setting for each individual song, as they are set in the song Options screen in Itunes?

    Is there a DJ app for the Ipad that will read the "start" and "stop time" setting for each individual song, as they are set in the song Options screen in Itunes? The Ipod Touch, by itself does not allow cross-fading, therefore when the stop time is edited short, the song jusst truncates then goes to the next song. I tried the DJay ap and while it would crossfade, it would NOT read the song settings for the stop marker. So now I want to try and Ipad and see if there is an app that will READ the Itune stop settings within the song. I do NOT want an app that will allow me to DO the stop marker. I want an app that will READ the stop marker from the song as it is set in Itunes.

    Itunes provides the option for setting the Start and Stop times of each music track.  However, the start and stop times do not synchronize to the iPhone.  I don't understand why this option is even available as it doesn't work when listening to music on the phone.  I have not found another application that will support the start and stop time markets.  I have searched quite a bit for this but can't find anything.  I hope we can find something. 

  • How do I get the 1121 card to read the switch and make it a 1 or 0 to count pulses?

    Hello,
    I am developing a test stand to test tires. We have LabView 7.1 and the SCXI chassis with an 1121 transducer card. I am trying to count the rate and total number of revolutions made by the tire. The signal is acquired from a 12V-proximity switch that is actuated once per RPM. The tire turns at 1,000 RPM or a little more.
    The signal will have to go through a 100-foot cable to get to the LabView chassis, will this be a problem?
    How do I get the 1121 card to read the switch and make it a 1 or 0 to count pulses?
    Will LabView be able to read this many pulses per second?
    How do I get MPH and a RPM reading out of it?
    Thank you,
    James Happe

    Hi James,
    Since you are cabling your DAQ board to an SCXI chassis with an 1121, you will not be able to use your counters without additional hardware.
    The 1121 is an analog input signal conditioning module. It performs filtering and attenuation to help measure analog signals. What it does not have is access to your board's counter pins.
    In order to use your counter pins you will need to get the necessary hardware. You have two options:
    1) Buy and SCB-68. This is a breakout box that will cable directly to your DAQ board replacing your SCXI chassis. You can connect your signals directly to your counter with this. However, I would advise against this because your application has a 12 volt signal. This will overload the 5v maximum voltage for your counter pins.
    2) Buy a 1180 feedthrough panel. This will allow you to use all of your DAQ board's functions with the SCXI chassis. Withouth the 1180 feedthrough panel, the SCXI-1121 is the only thing connected to your DAQ board. Since the 1121 only performs conditioning on the analog inputs, that is all you can access. The other pins cannot be used (no access). With the 1180 feedthrough panel, you can put a connector block on and access all of your other pins (including the counter pins). Again, I would advise against this since your 12 volt signal will overload your counter pins.
    My suggestion would be to perform an analog input task. Set up your 1121 in MAX and use a LabVIEW shipping example. In the shipping example select an analog input channel from your SCXI-1121 module. Set the appropriate voltage range and take some measurements. Once your signal is connected and you can read it using an analog input example you are half way there.
    Take the analog input shipping example and modify it to perform frequency analysis on the voltage readings. You can simply wire the data from the DAQmxRead VI into one of the frequency analysis VI's (noted in my first post). The output if that VI will give you the frequency of your signal.
    -Sal

  • How to read the date and time information of a file by labview

    how to read the date and time information of a file by labview? for example, created time and modified time.
    Solved!
    Go to Solution.

    if you need to know the last modification date of file:-
    "Functions->File I/O->Advanced File Functions->File/Directory Info.vi"
    This vi returns the value of file's last modification date. This is returned as U32 number. To see it in MM/DD/YY format you must create the indicator, right-click on it and select "Format & Precision" item from drop-down menu. Then select "Time and Date" format there.
    Thanks as kudos only

  • I meet a lot of 3G signal when a call signal disappears 3G! I read the manuals and anything I find the problem! I do so with other brands and other cell does not, the same goes when I receive a call!

    I meet a lot of 3G signal when a call signal disappears 3G! I read the manuals and anything I find the problem! I do so with other brands and other cell does not, the same goes when I receive a call!

    Who is your carrier?  Are you actually on 3G?
    Do you have 3G turned on or off?  Settings > General > Network > Enable 3G

  • How to read the method and put that code in 1 internal table

    Hi,
    Actually in the normal ABAP, if we want to read the report,  then we will write read report statement.
    If we want to read method then this statement will not work.
    So, to read the method and put that code in 1 internal table , which statement we need to write?
    Regards,
    Radhika

    Hi Naimesh,
    Thanks for your reply.
    As, i am not aware of ABAP Objects i am having some issues:
    Actually that is working for some methods in some classes.
    Here 1 issue is there:
    In se24 1 method is there in 1 class.
    Even by using that FM in SE37 i am able to get the program name by giving class and method name,
    but while using that FM in the program i am not able to get that program name.
    so, i am unable to read the source code of the program?
    1 example here:
    Class name is CL_GUI_FRONTEND_SERVICES.
    in this class, methods like FILE_EXIST , FILE_GET_SIZE, etc are there.
    By giving the class name and method name i am able to get the program name also,
    but while using that FM in the program i am not able to get that program name.
    so, i am unable to read the source code of the program?
    Here is my code:
    REPORT  Z16059_SCAN_METHOD.
    DATA: BEGIN OF I_PROGRAM OCCURS 0,
          LINE(256) TYPE C,
          END OF I_PROGRAM.
    DATA METHOD TYPE PROGRAM.
    DATA: BEGIN OF I_STRUCTURE,
          CLS_NAME(30) TYPE C,
          METH_NAME(61) TYPE C,
          END OF I_STRUCTURE.
    I_STRUCTURE-CLS_NAME = 'CL_GUI_FRONTEND_SERVICES'.
    I_STRUCTURE-METH_NAME = 'CL_GUI_FRONTEND_SERVICES-FILE_EXIST'.
    CALL FUNCTION 'SEO_METHOD_GET_INCLUDE_BY_NAME'
      EXPORTING
      MTDKEY             =  I_STRUCTURE
    IMPORTING
       PROGNAME          = METHOD
    EXCEPTIONS
       INTERNALMETHOD_NOT_EXISTING      = 1
       OTHERS                             = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ REPORT METHOD INTO I_PROGRAM.
    Please help me out in this regard.
    Thanks & Regards,
    Radhika

Maybe you are looking for