Excel File gets Locked using OLE2

Dear all ,
We are working with 10g forms
We are trying to load data from Excel file into a form using OLE2 . We are able to load the data from Excel File .
Here we try to read the first row of the excel file and verify for a title to be present
if not present we close the file . we have used the OLE2.Release_OBJ
declare
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
args ole2.list_type;
Check_file text_io.file_type;
no_file exception;
PRAGMA exception_INIT (no_file, -302000);
cell_value varchar2(2000);
begin
Lv_F_File_Type := Text_Io.Fopen(:Cb_Input.Ti_v_File_name,'R');
application:= ole2.create_obj('Excel.Application');
workbooks := ole2.get_obj_property(application, 'Workbooks');
args:= ole2.create_arglist;
ole2.add_arg(args, :Cb_Input.Ti_v_File_name);
workbook := ole2.invoke_obj(workbooks, 'Open', args);
ole2.destroy_arglist(args);
--Open worksheet Sheet1 of that Workbook
args:= ole2.create_arglist;
ole2.add_arg(args, 'Sheet1');
worksheet := ole2.get_obj_property(workbook, 'Worksheets', args);
ole2.destroy_arglist(args);
args:= ole2.create_arglist;
ole2.add_arg(args, Lv_n_rows);-- lv_n_rows value is 1
ole2.add_arg(args, 1);
cell:= ole2.get_obj_property(worksheet, 'Cells', args);
ole2.destroy_arglist(args);
cell_value :=ole2.get_char_property(cell, 'Value');
Lv_v_Title:=cell_value;
if Upper(Lv_v_Title) <> Upper(Lpk_Var.Lv_v_File_Name_Parameter) then
Lpk_Alert.Lp_Show('File Title Should be '||Lpk_Var.Lv_v_File_Name_Parameter);
OLE2.RELEASE_OBJ(cell);
OLE2.INVOKE(workbook ,'Close');
OLE2.RELEASE_OBJ(worksheet);
OLE2.RELEASE_OBJ(workbook);
OLE2.RELEASE_OBJ(workbooks);
OLE2.INVOKE(application, 'Quit');
OLE2.RELEASE_OBJ(application);*/
end if;
After this we open the excel , and modify and try to save , it just waits ...
we are forced to close the form. and then only the excel file gets saved...
we need to modify the file , when the form is running and then upload the data..
since the objects are closed , we are unable to understand why the excel file is locked till the session
Can any one help us
SSR

Hi,
Running on Business Object Enterprise XI 3.1 FP1.5.

Similar Messages

  • Using excell file on forms with ole2..... lock the excell file

    i want to read an excell file on a form. i use the ole2 library. And i dont know why the xls file get locked everytime i run the form.
    can you tell me how open and close a xls file without lock.
    thanks

    you need to relaase the object which contains the ole2 object otherwise the XLS file will lock
    first invoke quit option from the ole2 object
    and then destroy the object container.

  • How to upload Excel file in BI using function module in abap program

    How to upload Excel file in BI using function module in abap program?

    Hi Anuj,
    To upload the file , you can try a standard program "RSEPSFTP" .
    while you execute the program , a selection screen appears in which the inputs should be give as
    RFC destination - The target server name
    FTP command- PUT
    local file - your file name
    local directory - path of your local file
    remote file - your target file name
    remote directory - where it has to be stored
    Hope this is useful for you
    Thanks & regards
    Anju

  • Currency changes rates through TBEX from excel file getting erro

    Hi,
    When i am trying to upload the currency changes rates through TBEX from excel file getting error message:
    Error "The macro 'ThisWorkbook.TableBackToR3' cannot be f" occurred during macro execution
    Kindly guide what macro i need to define in excel sheet. or should i need to activate something in excel sheet relates to macros.
    Regards,
    Salil...

    When you call it the first time, it new Shell() constructs a new Display for you (the default).
    The second time, it gets the default display, but you are in a different Thread now. Since you have to create your widgets in the UI thread, it gives you that error.
    To run code in the UI thread, Display provides two methods:
    display.syncexec(..)and
    display.asyncexec(...)see
    http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/swt_threading.htm
    for more details.

  • How to generate excel file as output using OWB

    Hi,
    I have a requirement to generate an excel file as output using OWB.
    I am trying for a direct approach to create excel files.
    Though I know that excel can be created from a .csv file, I am looking for a direct approach to generate excel file without involving any .csv to excel conversion externally.
    Regards,
    Sri

    so, we are trying to do it by the help of oracle heterogeneous services. In my opinion it is possible (it depends on feature of ODCB Excel driver)
    For more details look at thread (it is about MS SQL Server but maybe it helps)
    Oracle to SQL SERVER
    Regards,
    Oleg

  • File getting locked in RDC when saving it to redirected drive (from remoteapp).

    Hello,
    when exporting excel file from our RemoteApp to my local C disk (\\tslcient\c) the file is getting locked and can not be used until I close the RemoteApp. If for example I try to delete file before closing RemoteApp,
    I get the error that file is being used by Remote Desktop Client.
    If during export I choose to save the file on remoteApp server, or on mapped network drive, it is not getting locked and can be used right away.
    Is there a way to save it to my redirected C drive and be able to use it without closing remoteApp ?

    Hi,
    Thank you for posting in Windows Server Forum.
    Initially see that you have client mapped drive is enabled. You can enable the setting under collection properties client settings-Drive Redirection Option. In addition, we can also check the GPO setting “Do not allow drive redirection” under below
    mention path.
    Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection
    Also can generate some script that would add shortcut and points to the shared drive. After this the shortcut would be added to the default location you see when you do the save file from your application.    
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    Client drive is redirecting without problem and it is accessible, we can browse it, copy and save files there.
    The problem is that when we save file from RemoteApp to redirected client drive, the file is locked by remote desktop connection process and can not be accessed until RemoteApp is closed.

  • Automatically create new Excel file from template using data from a selected row in a separate Excel file

    I am fairly new to Macro and VBA in Excel. I am trying to reduce the amount of work involved in a task that is performed often in our office. Currently, the task involves using 2 separate Excel files. One file is a tracking sheet and the second is the document
    that gets sent out to the client. The second document has all the same information that is inserted into the tracking sheet. What I would like to do is have the information that is in one row on the tracking sheet populate into a new excel file that is created
    automatically from an existing template.
    I have been able to make this partially work. What I have been able to achieve is have the cell that is selected in the tracking sheet (the description field) copy into the new file that is created from the template that is on our server.
    Sub NewRFI()
    ' NewRFI Macro
        MsgBox Selection.Address(ReferenceStyle:=xlA1, _
                               RowAbsolute:=False, ColumnAbsolute:=False)
        Selection.Copy
        Workbooks.Add Template:= _
            "template file path goes here"
        Range("C14").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
        Range("C14").Select
        Application.CutCopyMode = False
    End Sub
    What I need to do is get the rest of the information from that same row in the tracking sheet to copy to the new file as well. The other information includes the document number (one cell to the left of the selected cell), who it is from (one cell to the
    right of the selected cell), and the date (two cells to the right of the selected cell). As stated, this information is all in the same row on the tracking sheet. Each piece of information needs to be copied to a certain cell in the new file and I do not want
    the source formatting to be copied to the new file.
    Ideally, I would like it to operate like so: select the first cell in the row (in this case would be the document number field). Then click a button to run the macro that will then copy the information from that row in the tracking sheet to specific cells
    in the new file that is created from the template.
    This process will save us from having to either manually copy and paste the information into the new file or re-type the same information that is already in the tracking sheet.
    This is probably a simple thing to do but it would be great if anybody had some insight on this issue. Thanks in advance!

    Try code like the following. You will have to change the target cells (D25, F1 and H4) to the ones you want, I just used some arbitrary cells as example.
    Sub NewRFI()
    Dim rngCell As Range
    Set rngCell = ActiveCell
    MsgBox Selection.Address(ReferenceStyle:=xlA1, _
    RowAbsolute:=False, ColumnAbsolute:=False)
    Workbooks.Add Template:="template file path goes here"
    Range("C14").Value = rngCell.Value
    ' Change the target cells as needed
    Range("D25").Value = rngCell.Offset(0, -1).Value
    Range("F1").Value = rngCell.Offset(0, 1).Value
    Range("H4").Value = rngCell.Offset(0, 2).Value
    End Sub
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Excel File Error After Using SaveAsDialog in C#

    Hello,
    I have a project where I am trying to use SaveFileDialog. My code runs fine and saves the file to the directory that I choose. The problem is when I try to open the file I receive an error from Excel stating
     “Excel cannot open the file Test_File.xlsx because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file”
     Is there something happening in my code that is corrupting the file during the save process?
    I can’t figure out why I am getting this error. Any help will be greatly appreciated.
    I am working in VS 2013 Pro. and using C#. Here’s my code:
    private
    void btnSave_Click(object
    sender, EventArgs e)
    Stream saveFile;
    SaveFileDialog saveFileDialog1 =
    new
    SaveFileDialog();           
    saveFileDialog1.Title = "Save As";          
    saveFileDialog1.Filter = "Excel Files (*.xlsx)| *.xlsx";
    saveFileDialog1.FilterIndex = 2;
    saveFileDialog1.RestoreDirectory = true;           
    if (saveFileDialog1.ShowDialog() ==
    DialogResult.OK)
    if ((saveFile = saveFileDialog1.OpenFile()) !=
    null)
    // Code to write the stream goes here.
    saveFile.Close();
    Thank you,
    Dave
    David Young

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using ClosedXML.Excel;
    using DocumentFormat.OpenXml;
    using System.IO;
    namespace LoanOrig_FDIC_Codes
    public partial class Form1 : Form
    SqlCommand sqlCmd;
    SqlDataAdapter sqlDA;
    DataSet sqlDS;
    DataTable sqlDT;
    SqlCommand sqlCmdCnt;
    public Form1()
    InitializeComponent();
    //BEGIN BUTTON LOAD CLICK EVENT
    private void btnLoad_Click(object sender, EventArgs e)
    string sqlCon = "Data Source=FS-03246; Initial Catalog=ExtractGenerator; User ID=MyID; Password=MyPW";
    //Set the 2 dateTimePickers to today's date
    DateTime @endDate = End_dateTimePicker.Value.Date;
    DateTime @startDate = Start_dateTimePicker.Value.Date;
    //Validate the values of the 2 dateTimePickers
    if (endDate < startDate)
    MessageBox.Show("End Date must be greater than or equal to the Start Date OR Start Date must be less than or equal to the End Date ", "Incorrect Date Selection",MessageBoxButtons.OK,MessageBoxIcon.Error);
    //Reset both dateTimePickers to todays date
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    return;
    //End of date validation
    string sqlData = @"SELECT AcctNbr,
    CurrAcctStatCD,
    Org,
    MJAcctTypCD,
    MIAcctTypCD,
    NoteOriginalBalance,
    ContractDate,
    FDICCATCD,
    FDICCATDESC,
    PropType,
    PropTypeDesc
    FROM I_Loans
    WHERE CAST(ContractDate AS datetime) BETWEEN @startdate AND @enddate ORDER BY ContractDate";
    SqlConnection connection = new SqlConnection(sqlCon);
    SqlCommand sqlCmd = new SqlCommand(sqlData, connection);
    sqlCmd.Parameters.AddWithValue("@startDate", startDate);
    sqlCmd.Parameters.AddWithValue("@endDate", endDate);
    sqlDS = new DataSet();
    sqlDA = new SqlDataAdapter(sqlCmd); //SqlAdapter acts as a bridge between the DataSet and SQL Server for retrieving the data
    connection.Open();
    sqlDA.SelectCommand = sqlCmd; //SqlAdapter uses the SelectCommand property to get the SQL statement used to retrieve the records from the table
    sqlDA.Fill(sqlDS, "I_Loans"); //SqlAdapter uses the "Fill" method so that the DataSet will match the data in the SQL table
    sqlDT = sqlDS.Tables["I_Loans"];
    //Code section to get record count
    sqlCmdCnt = connection.CreateCommand();
    sqlCmdCnt.CommandText = "SELECT COUNT(AcctNbr) AS myCnt FROM I_Loans WHERE ContractDate BETWEEN @startDate AND @endDate";
    sqlCmdCnt.Parameters.AddWithValue("@startDate", startDate);
    sqlCmdCnt.Parameters.AddWithValue("@endDate", endDate);
    int recCnt = (int)sqlCmdCnt.ExecuteScalar();
    txtRecCnt.Text = recCnt.ToString();
    btnExport.Enabled = true;
    btnSave.Enabled = true;
    //End of code section for record count
    connection.Close();
    dataGridView1.DataSource = sqlDS.Tables["I_Loans"];
    dataGridView1.ReadOnly = true;
    //Reset both dateTimePickers to todays date
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    //END BUTTON LOAD CLICK EVENT
    //BEGIN BUTTON EXPORT CLICK EVENT
    private void btnExport_Click(object sender, EventArgs e)
    { //ClosedXML code to export datagrid result set to Excel
    string dirInfo = Path.GetPathRoot(@"\\FS-03250\users\dyoung\LoanOrig_FDIC_Codes");
    if (Directory.Exists(dirInfo))
    var wb = new XLWorkbook();
    var ws = wb.Worksheets.Add(sqlDT);
    ws.Tables.First().ShowAutoFilter = false;
    wb.SaveAs(@"\\FS-03250\users\dyoung\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xlsx");
    MessageBox.Show("File has been exported to U:\\LoanOrig_FDIC_Codes", "File Exported", MessageBoxButtons.OK, MessageBoxIcon.Information);
    //End of ClosedXML code
    else
    MessageBox.Show("Drive " + "U:\\Visual Studio Projects\\LoanOrig_FDIC_Codes" + " " + "not found, not accessible, or you may have invalid permissions");
    return;
    //END BUTTON EXPORT CLICK EVENT
    private void Form1_Load(object sender, EventArgs e)
    //Set dates to be today's date when the form is openend
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    private void Form1_Load_1(object sender, EventArgs e)
    // TODO: This line of code loads data into the 'dataSet1.I_Loans' table. You can move, or remove it, as needed.
    this.i_LoansTableAdapter.Fill(this.dataSet1.I_Loans);
    private void iLoansBindingSource_CurrentChanged(object sender, EventArgs e)
    //BEGIN THE SAVE AS PROCESS
    private void btnSave_Click_1(object sender, EventArgs e)
    Stream saveFile;
    SaveFileDialog saveFileDialog1 = new SaveFileDialog();
    saveFileDialog1.Title = "Save As";
    saveFileDialog1.Filter = "Excel Files (*.xlsx)| *.xlsx";
    saveFileDialog1.FilterIndex = 1;
    saveFileDialog1.RestoreDirectory = true;
    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
    if ((saveFile = saveFileDialog1.OpenFile()) != null)
    // Code to write the stream goes here.
    saveFile.Close();
    private void btnExit_Click(object sender, EventArgs e)
    this.Close();
    //END THE SAVE AS PROCESS
    Here is the code for the whole project up to this point
    David Young

  • Understand further about "excel files is locked for editting by me"

    Hi friends. I hope you are doing well.
    i have a problem with an user in my office when opening an excel file from Server:
    “<file_name>.xlsx is locked for editing” . The error shows that it is being used by its own user and that user could not open this file.
    - Our company is domain network and our Domain Controller is also File Servers.
    * I got a workaround action plan is: "unshared the folder which contains the problematic files in server, then share it again". However, this only works with folders which contain a small volume of data. For several GB it will take a considerable
    time and affect to network availability.
    I have few questions:
    1. Is there anyway to kill the process/service which is controlling the "excel files" at server ? ( Since i reboot client machine but the error message still persists), beside my workaround action plan.
    2.When i use OpenFilesView (from the link:  http://www.nirsoft.net/utils/opened_files_view.html) i can see that the excel files is opened by 2 process : "xlsx and xls" from remote computer. However, i can not kill the process using OpenFilesView.
    So i would like to ask: Is there any way to kill a process from remote host?
    3. What actually happens when sharing a files from Server in domain ? ( mechanism of sharing files)
    I would appreciate if you can give me some advices for my concern.
    Thank you very much! Have a good day.

    Hi,
    We have a lot of possible causes for this error, I would suggest your to take a look at this public blog and try the steps out there:
    http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2012/05/14/the-definitive-locked-file-post.aspx
    Also, below KB article describes the way that how Excel saves files, you might also want to take a look. There may be some softwares or process is accessing these temporary files.  Check if there is any temporary file (~$filename.xls
    or ~$filename.xlsx) in the shared folder, delete them and try again.
    http://support.microsoft.com/kb/814068/en-us
    Hope this helps.
    Thanks,
    Ethan Hua CHN
    TechNet Community Support

  • Suddenly can't edit in LR4 -- can DNG files get locked?

    I suddenly can't edit in "Develop" mode.  I can click on Lens Correction, but I can't seem to use the Basic adustments, Detail, or any others.   It's like I locked the DNG file from any more editing.  Any ideas?*

    Hi Ron,
    Can  you open the basic panel?
    ...just a weird idea... maybe you have set your develop panels to solo mode? So only one will be open at a time? <ctrl>1 should help, as this opens the basic panel.
    To answer your general question: it is not the DNG files that get locked - they are *locked* all the time.
    LR writes a record pointing to a DNG inside its catalog=database.
    That can not get locked.
    What exactly do you see when trying to do a basic adjustment?
    Could it be a performance problem - LR just being too slow for you to notice anything?
    What system are you using, which LR-version exactly?
    Cornelia

  • Excel files are locked since transfer from pc to mac

    I just transferred my excel files from pc to mac and now i can't open them, it says they are "locked for editing" by user (i did not lock them) i can only open as read only.  Is there a fix for this problem? Anyone else had this problem?

    Where are these files saved??
    Maybe this will help...
    I found this post on a different web site - http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macexcel/office-files -locked-for-editing-in-mixed/d838b0d7-6b26-4206-b310-029c73cf0ba6.
    This problem is caused by a temporary file that was not deleted after a previous edit session was completed. The file is hidden and not normally visible through the Finder. The easiest way to view hidden files is to install the hidden files dashboard widget which is available here:
    http://www.apple.com/downloads/dashboard/developer/hiddenfiles_matthansen.html.
    Use the widget to show hidden files then use Finder to open the folder that contains the spreadsheet you wish to edit. If your spreadsheet is named abc.xlsx, you will also see a file named ~$abc.xlsx. Delete the file that begins with ~$ and you will be good to go.

  • Import Excel file into SQL, using bulk copy - date issues

    Hello. I have a VB project where I need to import multiple excel files with lots of rows and columns into SQL 2012. Currently the import is set up, using OleDbConnection and insert commands and it takes up to 10 minutes to process all the spreadsheets.
    I'm trying to switch the code to use SQLBulkCopy, but experienced issues with dates columns. Some rows have Null dates and those are interpreted as strings and won't import into SQL tables. Is there a way to format the column prior to import programmatically?
    Any advice is appreciated.
    Note -
    If I add column mapping and exclude all dates columns - import works fine. All excel files have date fields, excel files are reports from other vendor and change on weekly bases, manual formatting of the excel files prior to import are out of the question...
    The code is just basic:
    Public Sub ImportFormExcelSample()
    Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyExcelSpreadsheet.xlsx;Extended Properties=""Excel 12.0 Xml;HDR=Yes""")
    ExcelConnection.Open()
    Dim expr As String = "SELECT * FROM [Sheet1$]"
    Dim objCmdSelect As OleDbCommand = New OleDbCommand(expr, ExcelConnection)
    Dim objDR As OleDbDataReader
    Dim SQLconn As New SqlConnection()
    Dim ConnString As String = "Data Source=MMSQL1;Initial Catalog=DbName; User Id=UserName; Password=password;"
    SQLconn.ConnectionString = ConnString
    SQLconn.Open()
    Using bulkCopy As SqlBulkCopy = New SqlBulkCopy(SQLconn)
    bulkCopy.DestinationTableName = "TableToWriteToInSQLSERVER"
    Try
    objDR = objCmdSelect.ExecuteReader
    bulkCopy.WriteToServer(objDR)
    objDR.Close()
    SQLconn.Close()
    Catch ex As Exception
    MsgBox(ex.ToString)
    End Try
    End Using
    End Sub
    The error I get is System.InvalidOperatiomException: The given value of type String from the data source cannot be converted to type date of the specified target column. System.FormatException: Failed to convert parameter value from String to a DateTime...
    Thank you!
    Alla Sanders

    Hi Alla,
    This issue might be caused because the field contains a NULL value, but the date/time columns in your table does not allow NULL values. Furthermore, please aslo take a look at "Data Type Issues" session in the article below:
    http://odetocode.com/blogs/scott/archive/2013/02/08/working-with-sqlbulkcopy.aspx
    Here is a similar thread about this topic for your reference, please see:
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/2d99181c-fc2b-4caf-9530-3bd6ae1745f1/sqlbulkcopy-column-validation-not-working?forum=sqldataaccess
    If you have any feedback on our support, please click
    here.
    Regards,
    Elvis Long
    TechNet Community Support

  • Modifying and saving a Excel file by the use of Blob-Stream Method?

    Hi everyone...
    I'm trying to change and modify a Excel file which is received as Blob variable from database.
    I wrote a PL/SQL Procedure which get the Excel file and convert it to blob; after that send it as the parameter of a Java source called TestPrintExcel
    CREATE OR REPLACE DIRECTORY VMI_TEST_DIR AS '/afc/opt/dba/test_utl_dir';
    GRANT READ, WRITE ON DIRECTORY SYS.VMI_TEST_DIR TO SYSTEM;
    declare 
       bfi  bfile := bfilename('VMI_TEST_DIR','TestFzglist.xls');
       bin  blob;
       cout clob;  
    begin
       dbms_lob.open(bfi);
       dbms_lob.createtemporary(bin, true);
       dbms_lob.loadfromfile(bin, bfi, dbms_lob.getlength(bfi));
       dbms_lob.close(bfi);
       dbms_lob.createtemporary(cout, true);
       dbms_java.set_output(100000);
       TestPrintExcel(bin);
       dbms_output.put_line('done!');
    end;With the following Java procedure I can read the content of the Excel file and write it to database perfectly. But the question is, how can i save the excel file with the same way, if i would change or insert any cell? I mean with the same way that to save as blob stream. Because i get permission error when i use another methods like FileOutputStream, FileInputStream etc. That's way i want to resolve this problem with the blob-stream method. Can anybody tell me how i can do that or what a method i have to use?
    Thanks.
    create or replace and compile java source named xltest as
      import org.apache.poi.ss.usermodel.WorkbookFactory;
      import org.apache.poi.ss.usermodel.Workbook;
      import org.apache.poi.ss.usermodel.Sheet;
      import org.apache.poi.ss.usermodel.Row;
      import org.apache.poi.ss.usermodel.Cell;
      import org.apache.poi.ss.util.CellReference;
      import org.apache.poi.ss.usermodel.DataFormatter;
      import org.apache.poi.ss.usermodel.FormulaEvaluator;
      import java.util.*;
      import java.sql.*;
      import oracle.sql.*;
      import oracle.jdbc.driver.*;
      public class XLTEST {
        public static void printx( oracle.sql.BLOB xblin ) throws SQLException {                       
          Connection Conn = null;
          try {
            Conn = DriverManager.getConnection( "jdbc:default:connection:" );
            Workbook wb = WorkbookFactory.create( xblin.getBinaryStream() ); // "/afc/opt/dba/test_utl_dir/TstFzglist.xls"
            for ( int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++ ) {  //NumberOfSheets
              String TableName = new String();       
              switch( sheetNum )
                case 0:
                  TableName = "freeimportxls_s1"; break;           
                case 1:
                  TableName = "FreeImportXLS_S2"; break;
                case 2:
                  TableName = "FreeImportXLS_S3"; break;
                default:
                  break;                  
              Sheet sheet1 = wb.getSheetAt(sheetNum);         
              java.util.Iterator<Row> ri = sheet1.rowIterator();                 
              while ( ri.hasNext() ) {
                Row row = ri.next();
                java.util.Iterator<Cell> ci = row.cellIterator();                       
                while ( ci.hasNext() ) {
                  Cell cell = ci.next();
                  CellReference cellRef = new CellReference( row.getRowNum(), cell.getColumnIndex() );                         
                  switch( cell.getCellType() ) {
                  case Cell.CELL_TYPE_STRING:                            
                    Values   += "'" + cell.getRichStringCellValue().getString() + "'";               
                    break;
                  case Cell.CELL_TYPE_NUMERIC:
                    Values   += "'" + cell.getNumericCellValue() + "'";
                    break;
                  case Cell.CELL_TYPE_BOOLEAN:
                    Values   += "'" + cell.getBooleanCellValue() + "'";
                    break;
                  case Cell.CELL_TYPE_FORMULA:
                    Values   += "'" + cell.getCellFormula() + "'";
                    break;
                  default:
                    Values   += "''";               
                  int Counter1 = cell.getColumnIndex() + 1;
                  int Counter2 = row.getLastCellNum();
                  if ( Counter1==Counter2 ) {
                    Values   += ")";                          
                  else {
                    Values   += "," ;
                } System.out.println ( Values );               
                if ( ( sheetNum >= 0 ) && ( sheetNum <=2 ) ) {
                   String sqlUpdate = "INSERT INTO " + TableName + " VALUES " + Values;
                   PreparedStatement pstmt = Conn.prepareStatement( sqlUpdate );                                          
                   pstmt.executeUpdate();           
                   pstmt.close();              
            } Conn.close();
          } catch ( java.sql.SQLException e ) {       
            System.err.println( e.getMessage() );
            e.printStackTrace( System.err );
            Conn.close();}        
      };

    Hi,
    Because i get permission error when i use another methods like FileOutputStream, FileInputStream etc.Permission errors are generally resolved by granting the proper privilege via DBMS_JAVA.grant_permission procedure.
    Have you already tried that?
    http://download.oracle.com/docs/cd/E11882_01/java.112/e10588/chten.htm#BABHDBCJ

  • Convert MS Excel File to XML using ssis

    Dear Experts,
    i want convert Excel file to XML(based on .XSD) using SSIS-2012.
    so request you to provide steps how to build this job.
    Thanks in Advance.
    Anil.

    Have Data Flow1 - Export Excel data to SQL Table
    Have Data Flow2 -
    Export SQL Table to XML by using FOR XML clause in your SELECT statement.
    FOR XML clauses has several options such as RAW/AUTO or specify the ROOT and then you get the XML the way you want.
    Another option is to use 3rd party Cozyroc -
    Template Task
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • Is there any way to read the data from an excel file w/o using a loop structure?

    I am retrieving a large amount of data (multiple sheets) from an excel file and would like to extract the entire range without retrieving individual cell values(too slow). I can write an range all at once but cannot read it.

    If you are able to write a block of data, then you should be able to read a block. The four requirements that you want to verify are:
    1. The Range specified must match the exact size and location of the data block you want to read
    2. The returned data is in a 2D array of Variants (either strings or numbers)
    3. Use Variant to Data to convert to 2D DBL or 2D Strings
    4. Check for the correct orientation for your application (use transpose if it is not)
    Michael Munroe
    Certified LabVIEW Developer
    www.abcdef.biz
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

Maybe you are looking for

  • Since I upgraded to itunes 11.1.1 (windows XP) when I try and sync podcasts Itunes crashes. What is the solution ?

    Since I upgraded to itunes 11.1.1 (windows XP) when I try and sync podcasts Itunes crashes.  What is the solution ?

  • "iCloud Photo Sharing" and "Optimize iPhone Storage"

    Before updating to iOS 8, my wife and I shared the same iCloud account. It was convenient for us to use the same Photostream, so pictures of our kids where always gathered together. But iOS 8 has too many features that make sharing same account troub

  • AS3 comboBox problem.

    Ok, I have a simple ComboBox with instance name of dragonCombo A Lable with an instance name of dragonLabel Using a an AS3 called Dragon.as When the ComboBox is clicked, a picture should pull up.   The problem is, there are no errors, but The ComboBo

  • Deployement changes are not reflecting on Test Server

    Hello All, I have Local (development)environment , I have deployed this application in Test envoirment as well and working fine. I have identified some changes and made changes on local machine and tested, now I am trying to deploy same changes on Te

  • Sony DVD's

    I have been using Handbrake and Mediafork with a lot of success to rip my DVD's to mpeg4 to watch them on my AppleTV. However, I am running into problems with Sony DVD's they have ARccOS protection and I am unable to rip so I can watch on my ATV. Any