I have this very specific requirement.
My database server is running on some linux server X, where I have written some stored procedure which will read the file from a DIRECTORY and create an XML table based on the content of that xml file.
Now, The file in picture can come from any machine i.e. it is uploaded by user in Browser and then we need to process it with the stored procedure.
Is there a way I can access the file of my local machine from the database server without mount/ftp? I mean, is there any utility in Oracle which can access file system of the client to read the file content?
is there any utility in Oracle which can access file system of the client to read the file content?
No, there is not. PLSQL program cannot reach your client PC. You have to upload it to the server then can use UTL_FILE to interpret it.
Related
I am creating a web app using Oracle apex and I need to draw data from an excel file or CSV file from a remote server, is the remote server option of oracle apex capable of that, is it possible to be done and how? thanks in advance.
If you are talking about the "Data Loading" page type, then yes - the Wizard creates several pages; one of them lets you browse for the source file. If the remote server's directory is mapped on your computer, you'll see it while browsing for the file and use it as data source.
I'd like to know, if is it possible to generate and retrieve the file using UTL_FILE package in oracle on the client side?
As far as I can tell, UTL_FILE operates with files on a server, stored in a directory accessible to Oracle. Therefore, you should CREATE DIRECTORY (oracle object) which points to a local directory (possibly, using UNC), grant required privileges (READ, WRITE most probably) and use that directory while working with UTL_FILE.
I would like to load a txt file into a CLOB field. The catch is that the file resides on the local disk (not on the oracle server). Is it possible to do this with pl/sql, running windows, perhaps from from TOAD or SQLPlus?
If so, could someone share the pl/sql?
I have seen several posts on loading a CLOB File from the server disk, Example1 and Example2. But can't seem to find anything on loading the file from local disk.
Thank you!
ps, It would be great if the routine supported multi-byte text (as in the examples).
No, you can't use a PL/SQL script to load a local file into table. But there is an alternative: loading local file(s) into CLOB field with local Oracle SQL*Loader. Install Oracle Client on your machine if you didn't do this before and use the article to create your own SQL*Loader config and script to running it.
How to read a file present in application server using external tables. I can't place the file in DB server as we are restricted from DB server.
According to the documentation, the data file for an external file must be visible to the server.
You access an external file via a DIRECTORY object in the database, which points to a directory on the db server.
Now, you can mount a drive so that it appears in the file system, but someone with access to the db server will probably have to do that.
I've used TEXT_IO package for creating files in the local(client) machine. From the documentation http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#BABBBABB I see that it is "available for both client-side and server-side PL/SQL". What does this mean?. Does it mean I can use it to create file in both client and server side? If so, which method/option should I use to create a file in the client side. Thanks.
UTL_FILE is a PL/SQL database package. It can read from or write to any directory which the oracle OS account has the matching privileges on. In practice this means directories on the database server, although directories on other servers - or even your local PC - can be shared with that server, through the good graces of your network administrator, and the DBA creating the appropriate Directory object.
TEXT_IO is an Oracle Forms package for writing to the client. Naturally it only works in client/server versions of the product, although the webutils library provides an implementation which can work in webform deployments.
The oracle OS account is the user which installed the Oracle software. We create the account before running the OUI. The oracle user has no direct relationship to any database accounts.
Processes inside the database can only read or write files in directories which the OS account can access. These processes include UTL_FILE, Data Pump, external tables, Java stored procedures running OS commands and extprocs, as well as background things like the alert log, dumps and trace files .
No, I think it means that UTL_FILE and TEXT_IO provide equivalent functionality for server and client respectively.