Posts

Showing posts from March, 2009

Working With File Throgh WebUtill

-------------------------------------------------- Required Configuraion : By default the file transfer is disabled in webutil for a security measure. So, you have to enable File transfer configuration in webutil.cfg file. The webutil.cfg file is located in  forms\server. Open The webuil.cfg file and edit the following parameters : transfer.database.enabled=FALSE   Change To TRUE transfer.appsrv.enabled=FALSE       Change to TRUE WebUtil_File contains APIs to manipulate files and directories on the client. These Functions Or APIs are: Copy_File :  Copies a file Returns a Boolean to indicate success.  Syntax :   Webutil_File.Copy_File(SourceFileName in Varchar2 , Destination In Varchar2) Return Boolean  Example   Declare  vCopied Boolean;  Begin   vCopied :=  Webutil_File.Copy_File('C:\temp\mypic.jpg','X:\destination_folder');  If vCopied = true Then    Message('File copied Successfully');  Else   Message('Error in Copying File');  End if; Delete_File:

Reading From File

-------------------------------------------------- Declare   vfilename varchar2(500);   in_file   Client_Text_IO.File_Type;   linebuf   VARCHAR2(1800);  BEGIN     vfilename := client_get_file_name('c:/temp/', File_Filter=>'Comma Dialimeted Files (*.csv)|*.csv|');      in_file := client_Text_IO.Fopen(vfilename, 'r');       GO_BLOCK('Emp');      FIRST_RECORD;     LOOP     Client_Text_IO.Get_Line(in_file, linebuf);      p_output_line(linebuf);     Client_Text_IO.New_Line;      Next_record;    END LOOP;     FIRST_RECORD; EXCEPTION   WHEN no_data_found THEN     Client_Text_IO.Put_Line('Closing the file...');     Client_Text_IO.Fclose(in_file); END; ------------------------------------------------------- PROCEDURE p_output_line(p_line varchar2) IS  vLINE VARCHAR2(4000); vVALUE VARCHAR2(1000);  vCOMMA_COUNT NUMBER; vREPORT_DATE DATE; BEGIN                      vLINE := p_line;  vCOMMA_COUNT := LENGTH(vLINE)- LENGTH(REPLACE(vLINE,',',''

Read From Excel

-------------------------------------------------- DECLARE  application OLE2.OBJ_TYPE;  workbooks OLE2.OBJ_TYPE;  workbook OLE2.OBJ_TYPE;  worksheets OLE2.OBJ_TYPE;  worksheet OLE2.OBJ_TYPE;  cell OLE2.OBJ_TYPE;  args OLE2.OBJ_TYPE;  cell_value number;  BEGIN  application := OLE2.CREATE_OBJ('Excel.Application');  ole2.set_property(application,'Visible','true');  workbooks := OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');  args := OLE2.CREATE_ARGLIST;  ole2.add_arg(args,'c:\test.xls');  workbook := ole2.GET_OBJ_PROPERTY(workbooks,'Open',args);  ole2.destroy_arglist(args); worksheets := ole2.GET_OBJ_PROPERTY(workbook, 'Worksheets');  worksheet := OLE2.GET_OBJ_PROPERTY(application,'activesheet'); for cols in 1..4 loop  -- columns for rows_index in 1..3 loop  -- rows args:= ole2.create_arglist;  ole2.add_arg(args, rows_index);  ole2.add_arg(args, cols);  cell:= ole2.get_obj_property(worksheet, 'Cells', args);  ole2.

ora-12638 credential retrieval failed

--------------------------------------------------  check the sqlnet.ora file. Change the following entry and try, this will work. Original Entry - SQLNET.AUTHENTICATION_SERVICES= (NTS) Modified Entry - SQLNET.AUTHENTICATION_SERVICES= (NONE)