Home » Developer & Programmer » Forms » TEXT_IO NOT WORKING FOR ALL USERS (ORACLE 11G)
TEXT_IO NOT WORKING FOR ALL USERS [message #641991] Fri, 28 August 2015 14:19 Go to next message
dstran
Messages: 7
Registered: August 2015
Location: md
Junior Member
Form when button pressed trigger

TFile := TEXT_IO.FOpen( 'C:\..\filename.txt', 'w' ) ;

Line :='Test line';
TEXT_IO.PUT_LINE( TFile, Line ) ;
TEXT_IO.FClose( TFile);


Works for dba level users, but not others
Re: TEXT_IO NOT WORKING FOR ALL USERS [message #641993 is a reply to message #641991] Fri, 28 August 2015 14:37 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What does "it doesn't work" mean? Do you get any error? If so, which one? Where is it raised (at which statement)?
Which Forms version do you use (specifying "Oracle 11g" means what? Is it your database version, or your Forms version)?
Which operating system do you use?

Anyway: check whether "other" users have required (i.e. WRITE) privileges to write into the target directory.
Re: TEXT_IO NOT WORKING FOR ALL USERS [message #642031 is a reply to message #641993] Mon, 31 August 2015 11:32 Go to previous messageGo to next message
dstran
Messages: 7
Registered: August 2015
Location: md
Junior Member
form 11.2.1.1.0 db 11.2.0.4.0 on windows 2012 box
when button press fails with error frm-40735 / ora-04067

I did a GRANT EXECUTE ANY PROCEDURE TO "the non dba level user" and now it works, file is written with the test line.
so how would I go about pin pointing the exact procedure to grant instead of execute any to that user?




Re: TEXT_IO NOT WORKING FOR ALL USERS [message #642061 is a reply to message #642031] Tue, 01 September 2015 09:11 Go to previous messageGo to next message
dstran
Messages: 7
Registered: August 2015
Location: md
Junior Member
decided to use UTL_FILE instead. Accomplished the same task. Thanks.

--Create upload dir on the DB side
CREATE OR REPLACE DIRECTORY
UPLOAD_DIR AS
'c:\...\';

GRANT READ, WRITE ON DIRECTORY UPLOAD_DIR TO the_user_role;


--when button pressed

DECLARE
fileHandler UTL_FILE.FILE_TYPE;
BEGIN
fileHandler := UTL_FILE.FOPEN('UPLOAD_DIR', 'test_file.txt', 'W');
UTL_FILE.PUTF(fileHandler, 'Writing to file\n');
UTL_FILE.FCLOSE(fileHandler);
END;
Re: TEXT_IO NOT WORKING FOR ALL USERS [message #642091 is a reply to message #642061] Wed, 02 September 2015 08:18 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
Quote:
I did a GRANT EXECUTE ANY PROCEDURE TO "the non dba level user" and now it works

You may want to re-think granting this privilege to non-DBA level users. You've just enabled this user to execute "ALL" system level procedure/packages. A better option would be to grant EXECUTE on just the procedure the user needs, such as UTL_FILE.

Craig...
Re: TEXT_IO NOT WORKING FOR ALL USERS [message #642107 is a reply to message #642091] Wed, 02 September 2015 13:58 Go to previous message
dstran
Messages: 7
Registered: August 2015
Location: md
Junior Member
yes, decided to use UTL_FILE and created granted to the role
Previous Topic: Logic for EDIT button
Next Topic: Create data link in oracle report
Goto Forum:
  


Current Time: Fri Mar 29 04:50:42 CDT 2024