Uploading Documents to Another Database Through APEX
Hi,
I am trying to find a solution for uploading documents through APEX, but storing them in a database on a different server other than the server where apex is installed.
I am unable to use DBLINK, because we are needing to pass a BLOB column. We have also looked into the DAD, but it only allows for one database connection for the APEX instance. I am pondering with creating a database connection to the other database when needing to upload a document, but not certain if that is the most efficient way.
I am wanting to know if there is a way to upload documents (BLOBS) through APEX that is installed on DATABASE A, but store the documents in DATABASE B?
Thanks,
Keisha
Ok...up front warning...this is a bit klugey but, it does work.
In the APEX database:
Create the table (with the BLOB column) to which you will upload the documentsWe're going to get them to the remote DB but, for reasons that will become apparent shortly, they need to go here first.
In the Remote database:
Create a DB Link to the APEX database.
Create a Materialized View that selects from table with the the BLOB column in the APEX database
In the APEX database:
Create a local synonym that points to the DBMS_REFRESH package in the Remote database.For this example, we'll name the synonym REMOTE_DBMS_REFRESH
Create a PL/SQL procedure that does the following:
Upload the document to the APEX database
Fire the REFRESH method for the MV that you created using REMOTE_DBMS_REFRESH
Remote the data from the APEX database
For whatever reason, the restriction to copy LOB data over the link is by passed when using a Materialized View.
Cheers,
-Joe
Similar Messages
-
How to upload a file to database in Apex 4.2.2?
How to upload a file to database in Apex 4.2.2 in Existing Application? Also How to view the uploaded file within this application?
Any help to his question is very appreciated?
Thanks,
Prak.980835 wrote:
Please update your forum profile with a real handle instead of "980835".
Actually we want to upload the file to our own table and retrive from it as well. Is it possible to see the file of person whom we are pulling?
This is covered in the documentation: About BLOB Support in Forms and Reports. There's also a tutorial in the Oracle Learning Library. -
Can we copy the marketing and banking documents to another database
dear all,
Is it possible to copy all the marketing documents and banking documents form one database to another. The target database is fresh one. Please help me in this.
thanks and regards,
Yeshwanthhi prakash,
Why don't specifically want to copy marketing & banking documents from old db ?
1. Take latest Backup of old databse & restore it in new one.
2.Extract the datas thru SQL queries in old database & then map this data to DTW templates &
Import datas thru DTW to new database.
Jeyakanthan -
How to upload document to Solar01 "background" through FM or Class
I tried do some searches through the forum and can't find related post related upload document to Solution manager in background mode.
Found a thread(ABAP function to upload document in SOLAR01) recommend standard class CL_SA_DOC_FACTORY=>UPLOAD_DOC to upload document, however this class can only be executed in foreground mode.
I will copy all the documents into app server and write a abap program to read the app server's file and upload to solar01. Still struggling for the part 2: write abap program.
Appreciate if someone can provide some inputs for this or did something similar before?Hi Ching,
Here are the methods and the FM you need to call in order.
CALL METHOD CL_SA_DOC_FACTORY=>UPLOAD_DOC
EXPORTING
I_DOC_TITLE = 'XXXXXXXXXXXXX'
I_DOC_TECH_NAME = 'XX'
I_DOC_TYPE = 'AD'
* I_DOC_STATUS = 'COPY_EDITING'
I_FOLDER_TECH_NAME = 'ZJON'
I_FOLDER_RESPONSIBLE = SY-UNAME
I_FOLDER_GROUP = 'ZJON'
IP_FILEPATH = l_filetable_s
RECEIVING
E_IOBJECT = lo_new_document
EXCEPTIONS
CANCELLED = 1
FOLDER_ERROR = 2
ERROR = 3
others = 4.
CALL METHOD LO_NEW_DOCUMENT->SAVE
RECEIVING
E_LOIO = lv_loio
EXCEPTIONS
CANCELLED = 1
ERROR = 2
others = 3.
IF SY-SUBRC <> 0.
ENDIF.
once u have the lv_loio
CALL FUNCTION 'INFO_OBJECT_PROPERTIES_GET'
EXPORTING
INFO_OBJECT = lv_loio
* SUPPRESS_AUTHORITY_CHECK = 'X'
* INTERNAL_REPRESENTATION =
* RETURN_STR_DESCR = ' '
* IMPORTING
* ERROR_MSG =
TABLES
REQUESTED_PROPERTIES = r_prop
PROPERTIES = prop
* CONTEXT =
READ TABLE prop INTO ls_property
WITH KEY name = 'IWB_SOLAR_DOCUTYPE'.
IF sy-subrc EQ 0.
lv_note_type = ls_property-value.
ELSE.
lv_note_type = 'AD'.
ENDIF.
CONCATENATE lv_loio-class ' ' lv_loio-objid INTO lv_objectkey SEPARATED BY space.
CONSTANTS sappl_c_tabtype_custdocu type sappl_tabtype_type value 'CUSTDOCU'.
CALL FUNCTION 'NOTE_OBJECT_SAVE'
EXPORTING
* id = 'E100346536B4E0F19AFD000C29BB263E'
id = handle_id
application = 'SO'
filtertree = project_filter
note_id = lv_loio-objid
note_type = lv_note_type
objectkey = lv_objectkey
save_location = ''.
* sequence = '0000000021'.
I hope it helps you
Kind regards
Jon -
How do you know the object is from another database through db link
I have a table named a2z_people. I searched dba_objects, I found this is a public synonym.
How can I know the real table name in the another database. Where is this table come from? In another words, what's the source database?
Thanks!In DBA_SYNONYMS, there is a DB_LINK column that names the database link being used (assuming the real object is on a remote database). Is that what you're looking for?
Justin -
WEBUTIL_PG.WRITE_DATA( ) and uploading documents into the database
When we run our Forms application through Forms Builder, with the user account utilized by our actual users, we're able to upload a file into the database using webutil. This particular database user account is restricted to only the tables and packages it needs access to, granting the full SELECT, INSERT, UPDATE, DELETE to the tables, and then EXECUTE on the packages.
However, when our Developers use their personal database accounts, which essentially have SELECT ANY .. EXECUTE ANY ... etc, this upload process is halted within webutil.pll when it calls the database PACKAGE procedure WEBUTIL_PG.WRITE_DATA( ). It just hangs on that step.
When you look in OEM, during that hang the graph is showing high levels of "Network" activity. Just a solid plateau. We can't figure out why the difference between these accounts has an effect. Does someone see a pattern here that we're missing?
Thanks,
--=Chuck"Still sounds like a permissions issue to me." I know right?
So I logged in as myself. I have DBA privileges in the database. The call to the database package hung for me as well. No error ... just a hung cursor.
As for debugging ... the call to WEBUTIL_PG hangs, when the Forms code gets to that point in the webutil.pll. So we never even get to the database.
Our next step, is to try to recreate the process solely in PL/SQL without webutil.pll, but the code in there is pretty extensive, and teasing out only the pieces we'll need is pretty tricky. -
Uploading csv file into database using apex
Dear all
I am using apex 4 and oracle express 10g, i need to upload .csv file into the database for one of my appls, i have referred discussion forum for solutions, i found also, but some how its not working for me.
below mentioned is error and the code
ERROR:
ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: Statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: Statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 40, column 8: PL/SQL: Statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
Error
OK
CODE:
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
BEGIN
-- Read data from wwv_flow_files
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv';
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11);
-- Clear out
v_line := NULL;
END IF;
END LOOP;
END;
what i understand from this is system does not identify v_data_array as array for some reasons, please help me.
initially system was giving error for hex_to_decimal, but i managed to get this function on discussion forum and now it seems to be ok. but v_data_array problem is still there.
thanks in advance
regards
UdayHi,
Mistakes in your sample I did correct
Problem 1
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv'; to
select blob_content into v_blob_data
from wwv_flow_files where name = :P1_FILE;Problem 2
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11); to
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4),
v_data_array(5),
v_data_array(6),
v_data_array(7),
v_data_array(8),
v_data_array(9),
v_data_array(10),
v_data_array(11); And I did create missing table
CREATE TABLE TABLE_X
v1 VARCHAR2(255),
v2 VARCHAR2(255),
v3 VARCHAR2(255),
v4 VARCHAR2(255),
v5 VARCHAR2(255),
v6 VARCHAR2(255),
v7 VARCHAR2(255),
v8 VARCHAR2(255),
v9 VARCHAR2(255),
v10 VARCHAR2(255),
v11 VARCHAR2(255)
);Regards,
Jari
Edited by: jarola on Nov 19, 2010 3:03 PM -
Is it possible to upload few column in table through Apex Data Loading
Hi All,
I have to do upload into the table through a csv file . The table's primary key i have to load the rest through user's uploaded file. Is it possible to do the data loading to the table only to required columns and fill the other columns from backend. Or is there any other way to do this?Hi,
Your query is not really clear.
>
Is it possible to do the data loading to the table only to required columns and fill the other columns from backend. Or is there any other way to do this?
>
How do you plan to "link" the rows from these 2 sets of data in the "backend"? There has to be a way to have a relation between them.
Regards, -
Hi Everyone,
I'm trying to migrate a few mailboxes from a database called "primary" to "archive". I can migrate a single user through powershell, however I cannot migrate users through the GUI. When the "syncing" starts, it reverts the total
from "2" to "0" and makes it appear as though I never added any users to the batch job. The job then completes "successfully"
I can see the users in the job before I hit start. Any idea why my job goes blank?
I'm running exchange 2013 CU6Hi ,
Thank you for your question.
We could refer to the following steps to troubleshoot:
Restart IIS to check if the issue persist.
End up of the user job to check if the issue persist.
Create a new account to check if the issue persist.
We could check relevant application log, then we could check if EAC and EMS connect to same domain controller, then we could check sync between Exchange server and domain controller.
If there are any questions regarding this issue, please be free to let me know.
Best Regard,
Jim
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
Jim Xu
TechNet Community Support -
Accessing 3 or 4 databases tables through apex.
Hi There,
I have a requirement, I have to create few dashboards on apex and each dashboard corresponds to different databases.
For example:
I will have a list of databases name in the first page of apex (or it could be tab name) and when I click on the specific database name, it should go to a page which has some reports based on the tables of that database like wise if I click on the other database name, it should go to a page which has some reports based on the tables of that database and so on...
Is it possible to access different databases through Apex?
If yes could you please share some documents or links demonstrating it.
Please help!!
Thanks in advance,
Pushpesh PallavThank you Scott.
The other challenge I have is all the databases are on different different VPN and due to some reason I can't install all the VPN's on the apex server.
Now if I connect the apex to the other databases using dblink, it will give error as VPN will not be connected.
Is there any way the VPN's will be connected dynamically through apex or without VPN we could access the databases through apex??
Regards,
Pushpesh Pallav -
Pointing to external Database from apex application
Hi Guys,
Is that possible to point to databse exist in another server through apex application ? is there any configuration like that ?You would make this kind of connection within a schema/database that your Apex instance already has access to, or a different schema, which you would then make available to Apex. Once you have this setup you can reference the external database/tables just like any other table in Apex. You may be limited to which operations are supported on the external data, depending on whether it's an Oracle dblink or an ODBC connector, etc.
Earl -
How to insert document into xmltype column through an http post request with perl
Oracle 11.2.0.3
Windows server 2008r2
Apache tomcat 7.0
Oracle APEX 4.2.1
Oracle APEX Listener 2.0
I would like to insert a XML document into the database through an APEX restful web service. The POST into the web service in done with PERL. The following code will insert an empty record in a table with column of XMLType type.
Perl Code
use strict;
use warnings;
use LWP::UserAgent;
use HTTP:Headers;
my $headers = HTTP::Headers->new();
my $url = "http://host:port:apex/<application_workspace>/<restfull service module>/<uri template>/
my $sendthis = ('<?xml version="1.0" enconding="utf-8"?>
<students>
<row>
<name>Mark</name>
<age>30</age>
</row>
<./students>';)
$headers -> header('Content-Type' => 'text/xml; charset=utf-8');
my $request = HTTP:Request->new('POST', $url, $headers, $sendthis);
$request-> protocol('HTTP/1.1');
my $browser = LWP::UserAgent->new();
my $response = $browser->request($request);
my $gotthis= $response->content();
my $the_file_data = $response->content();
APEX restful service
Method: POST
Source type: PL/SQL
MIME Types allowed: blank
require secure access: none
source:
{declare
doc varchar2(32000);
begin
insert into table <column name>
values(doc);
commit;
end;
Table code
{ create table <tablename>
(column name XMLType>);
The above code will insert an empty column into the table.
Any ideas why?It's a really bad idea to assemble XML using strings and string concatenation in SQL or PL/SQL. First there is a 4K limit in SQL, and 32K limit in PL/SQL, which means you end up constructing the XML in chunks, adding uneccessary complications. 2nd you cannot confirm the XML is valid or well formed using external tools.
IMHO it makes much more sense to keep the XML content seperated from the SQL / PL/SQL code
When the XML can be stored a File System accessable from the database, The files can be loaded into the database using mechansims like BFILE.
In cases where the XML must be staged on a remote file system, the files can be loaded into the database using FTP or HTTP and in cases where this is not an option, SQLLDR.
-Mark -
Storing MS-Word and PDF documents in database uploaded through APEX
I want to allow users to upload MS-Word and PDF documents they have created / edited outside of the APEX app for storage in the database along with the other app data.
I know that I should use a file browse item in a region for this purpose.
I have a some questions:
1. What database datatype is best for storing MS-Word and PDF docs? CLOB?
2. How can the user see that the file has been uploaded? In other words, how can they see that the filename has been uploaded? I want to show this on the page for later viewing. I have uploaded a document, but later, I have no way to see that the document has in fact been uploaded. From the APEX page, the file browse item does not indicate whether or not a file has previously been uploaded.
3. How can the user download the previously uploaded document?
4. Is there a way to give users the capability to edit a document in an APEX app where they can do MS-Word-like editing (font size, font type, bold, italics, etc.)?
I know I've asked a lot here and I appreciate your input.
-ReidIn my case, I am uploading screenshots of my application and then displaying them. You can feel free to use it if you want, the code was mostly taken from examples of file uploads posted by others. Here is some code to get you started:
File Table description
CREATE TABLE FILE_UPLOAD
(name VARCHAR2(4000) PRIMARY KEY,
subject VARCHAR2(4000),
id NUMBER,
blob_content BLOB,
mime_type VARCHAR2(4000),
PAGE_ID NUMBER);File Upload Procedure
IF ( :P20_FILE_NAME is not null ) THEN
INSERT INTO FILE_UPLOAD (id, NAME, SUBJECT, BLOB_CONTENT, MIME_TYPE, PAGE_ID)
SELECT ID,:P20_FILE_NAME,:P20_SUBJECT, blob_content, mime_type, :P20_PAGE_ID
FROM APEX_APPLICATION_FILES
WHERE name = :P20_FILE_NAME;
DELETE from APEX_APPLICATION_FILES WHERE name = :P20_FILE_NAME;
END IF;Download Image Procedure Definition
CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
INTO v_mime,lob_loc,v_file_name,v_length
FROM FILE_UPLOAD
WHERE id = p_file;
-- set up HTTP header
-- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end download_my_file;
/make sure to grant the procedure rights for use by anyone
GRANT EXECUTE ON download_my_file TO PUBLICDisplay Image Procedure Definition
create or replace PROCEDURE "DISPLAY_IMAGE"
inID NUMBER
AS
vMIME VARCHAR2(48);
vLENGTH NUMBER;
vFILENAME VARCHAR2(2000);
vBLOB BLOB;
BEGIN
SELECT MIME_TYPE, BLOB_CONTENT, NAME, DBMS_LOB.GETLENGTH(BLOB_CONTENT)
INTO vMIME, vBLOB, vFILENAME, vLENGTH
FROM FILE_UPLOAD
WHERE ID = inID;
owa_util.mime_header(nvl(vMIME, 'application/octet'), FALSE);
htp.p('Content-length: ' || vLENGTH);
owa_util.http_header_close;
wpg_docload.download_file(vBLOB);
END;
/Again, make sure everyone has rights to execute the procedure.
GRANT EXECUTE ON DISPLAY_IMAGE TO PUBLICThis doesn't create an editor inside the browser, it just creates a simple upload/display process. For a WYSIWYG editor that handles PDF or Docs, you'll need something far more sophisticated, and I can't suggest anything there. -
Problems while uploading text documents into Unicode Database
I just upgraded our database from 9iR1 to 9iR2 (9.2.0.1.0). The server
character set is AL32UTF8. Now I'm facing a problem when
uploading text documents into the database via a web frontend.
I use the upload table defined for the PL/SQL Database Access Descriptor:
create table TB_UPLOAD (
NAME VARCHAR2(256) not null,
MIME_TYPE VARCHAR2(128),
DOC_SIZE NUMBER,
DAD_CHARSET VARCHAR2(128),
LAST_UPDATED DATE,
CONTENT_TYPE VARCHAR2(128),
BLOB_CONTENT BLOB);
After uploading a text document containing the two words "hallo welt",
the following statement returns not "hallo welt", but "68616C6C6F2077656C74":
declare
b_loc blob;
v_amount integer := 100;
v_buffer varchar2(100);
v_offset integer := 1;
begin
select blob_content into b_loc from tb_upload where name like 'mydoc.txt';
dbms_lob.read(b_loc, v_amount, v_offset, v_buffer);
htp.prn(v_buffer);
end;
What is this? I studied the documentation, but didn't found a solution.
When trying to use Oracle's built-in procedure wpg_docload.download_file,
the content is shown the way it should be. Unfortunately, I can't use
wpg_docload.download_file in order to copy the BLOB content to another table.
Any hints would be appreciated!
Thanks so much in advance!
Roman
E-Mail: [email protected]Hi Roman,
the upload uses a BLOB (Binary Lob). Your Document is
stored as is in the binary representation. If you
use dbms_lob.read on a blob and your buffer is a varchar2 the binary representation is not translated!!!
use a raw for the buffer and utl_raw.cast_to_varchar2
to do the conversion to varchar.
try this
Procedure SHOW_DOC(p_name doc_test.name%TYPE)
IS
v_len number;
v_mime_type tb_upload.mime_type%TYPE;
v_offset integer := 1;
v_Buf_size integer := 32767;
v_buf raw(32767);
v_blob blob;
v_Doc_name varchar2(1000);
BEGIN
v_doc_name := url_Decode(p_name);
select mime_type,doc_size,blob_content
into v_mime_Type,v_len,v_blob
from tb_upload
where name = v_doc_name;
OWA_UTIL.MIME_HEADER(v_Mime_Type);
begin
LOOP
DBMS_LOB.READ(v_blob,v_buf_size,v_offset,v_buf);
HTP.PRN(UTL_RAW.CAST_TO_VARCHAR2(v_buf));
v_offset := v_offset + v_buf_size;
END LOOP;
exception
when no_data_found then
null;
end;
END;
HTH
detlev -
Store and display word document in database through forms
how can i store a word document in database through forms 6i or 10g, and display it through forms from database.
i know how to store a binary file in database through DBMS_LOB package, but i want to do it throug forms. is it possible?
regardsHi Alex
"Create a datablock and specify the item datatype as blob"
BUT: How to bring the document to the blob?
Hi user 611..
Warning: It is easy if you use an OLE-Object - but OLE is a special format. The result will not be the same as with dbms_LOB.
We have a application with documents stored via OLE - terrible!
OLE is no longer supported by forms 10. But webutil would help.
I asked a similar question and got a good answer:
OLE-Container and migration to the web
Wolfram
Maybe you are looking for
-
Purchase Requisition Field Mandatory
Dear All, I want to make purchase requisition field mandatory in selected purchase order types. i tried through field selection in SPRO, by changing the screen layout., but still its not coming as mandatory. Kindly provide a solution ...
-
What are the advantages to adding a server to my home/home office system?
What are the advantages to adding a server to my home/home office system?
-
Ibooks pdfs do not sync between devices?
Is Ibooks supposed to sync between devices?
-
Queries for FOR ALL ENTRIES IN
1. If I use For all entries in inspite of loop within loop , wil it help in increasing processing time ?? 2. There is one problem in For all entries in , it is not fetching all entries but it left entries having same data so is it like t
-
Create a file and store it in the database using UTL_FILE package
Hello. I'm using UTL_FILE package to store data from a table into an excel file but I don't know how to store this file in a table with a BLOB field the database at the same time. I want do do this because I will use it in a Oracle Portal. Anybody ha