Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TEXT_IO PROBLEM

Status
Not open for further replies.

gieboy

Programmer
Feb 15, 2001
20
0
0
PH
I have 2 applications using text_io package, one is reading a file and the other one is writing. When i deploy both applications on the web, ive got an error on my first application(reading file) that says ora-302000. the second application(writing on a file) have no errors but the file was lost, i already check the apps server for the file but it wasnt there, i also check the client machine and still no file were found.

Can anyone Help me on this?



here's an example of the code(reading file)

Declare
cSpoolFile VARCHAR2(500) := 'connectinfo.txt';
in_file TEXT_IO.FILE_TYPE;
lineread Varchar2(4000);
urn Varchar2(4000);
urp Varchar2(4000);
constr Varchar2(30);
Begin

in_file := TEXT_IO.FOPEN(cSpoolFile, 'R' );
Text_IO.Get_Line(in_file,lineread);
urn := rtrim(lineread);
Text_IO.Get_Line(in_file,lineread);
urp := rtrim(lineread);
Text_IO.Get_Line(in_file,lineread);
constr := rtrim(lineread);
TEXT_IO.FCLOSE( in_file );

End;
 
The vanishing act could be caused by trying to assign a value that is larger than the variable allows. Are you sure the 3rd line, after it's trimmed, is 30 characters or less?
 
ORA-302000 is usually casued by the file you are trying to read from being absent. Try putting the full path into the FOPEN string, eg '\usr\home\<user>\connectinfo.txt'. This also applies to the output file.

You do know that TEXT_IO in a web form will read and write files on the server and not the client?
 
I think the problem is that on the web, the text_io package is saving the files to the web server's filesystem, so unless you have used a fully qualified network path (eg. \\NetServer1.tek-tips.com\D$\Forms\TextFile.txt) you won't be able to find it.

The connectinfo.txt in the example above will be trying to read from the form-server's first directory in its Forms_path registry entry (HKEY_LOCAL_MACHINE\Software\ORACLE\FORMS_PATH or HKEY_LOCAL_MACHINE\Software\ORACLE\HOME0x\FORMS_PATH).

If you do a search on the web server's directory system for the file you are writing, you will find it. This is the place your application is trying to read from as well (first entry in the forms-server home's FORMS_PATH) If you copied the connectinfo.txt into that directory, you app will work.

nme
 
Forgot to say - you need to do a full search on the application server for the file you write. You can't just do it in your Aplication's area, it has to go across all fixed drives. The easiest way to find it as I said earlier is to look for the the first entry in the FORMS_PATH.

To make sure its not variables being too small, add alerts in between your code to show where it got to before failing - this is the only way we've found so far to debug the application via the web. We've created a procedure that sets up and shows the alert from one call.

I'll try checking the listings tomorrow to see if this has helped or not.
 
gieboy, did you sort out your problem then?
 
Thanks a lot guys for the help. Yes you are all right the files were saved on the application server. My applications are now working properly but i still do have a problem. I need the files to be on the client machine. any tips on this? Again thanks to all . May the force be with you always.
 
A Java Bean would be pretty good, but you should be able to get away with just fully-qualifying the path of the file to point at a client PC, to get this you'd have to work out which client you are on when you make the request (I think this can be done via client-side scripts that sends a parameter to the Oracle Form). You'd also have to give the application server the rights to write files to all of the clients (You'd have to ask someone with more knowledge of OS domains than I have to do this, I think it shouldn't be that hard though).

Maybe the Java Bean is a cleaner approach?!

Since you quoted star wars, I have a question about Ep II - why didn't the head fall out of the helmet?

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top