Thursday, March 16, 2006

Where are the /images of Application Express in OracleXE?

In a standalone Apex installation, the required images, css and javascript files are accessible via the virtual path /i.

This virtual path mapping looks something like this in your marvel.conf (or dads.conf) file:
Alias /i/ /opt/oracle/oracle/product/10.2.0/htmldb/images/

But where are the images in OracleXE?

When you look at http://127.0.0.1:8080/i you will see that the images are available, but they cannot be found in the filesystem.


In OracleXE these resources are stored directly in the database, using the Oracle XMLDB feature.
You can access the resources and modify them directly by using the WebDAV feature of the XMLDB.

(1) With Internet Explorer, just go to File > Open > http://127.0.0.1:8080/i (check "open as webfolder"):

(2) You will be prompted for user credentials, enter username and password for the database user SYSTEM:
(3) After that you can access the files via WebDAV directly, using Drag&Drop:


Update (19.03.2006)

If you don't have an Internet Explorer for connecting via WebDAV available, you can also use another WebDAV client like sitecopy or cadaver ( http://www.webdav.org/projects/ ).

Or you can simply use a plain FTP client to modify the files:

(1) Enable FTP access to the database:
www:oraclexe[XE]> sqlplus system@xe
SQL*Plus: Release 10.2.0.1.0 - on Sun Mar 19 22:20:36 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0

SQL> exec dbms_xdb.setftpport('2100');

PL/SQL procedure successfully completed.

SQL> alter system register;

System altered.

SQL> select dbms_xdb.getftpport as "FTP-Port" from dual;

FTP-Port
----------
2100

SQL> exit


(2) Modify the files via FTP:
www:oraclexe[XE]> ftp localhost 2100
Connected to localhost.localdomain.
220- www
Unauthorised use of this FTP server is prohibited and may
be subject to civil and criminal prosecution.
220 www FTP Server (Oracle XML DB/Oracle Database) ready.
Name (localhost:oraclexe): system
331 pass required for SYSTEM
Password:
230 SYSTEM logged in
Remote system type is Unix.
ftp> cd i/themes
250 CWD Command successful
ftp> dir
200 PORT Command successful
150 ASCII Data Connection
-rw-r--r-- 1 SYS oracle 3075 OCT 10 03:41 generic_list.gif
-rw-r--r-- 1 SYS oracle 1307 OCT 10 03:41 generic_nochild.gif
-rw-r--r-- 1 SYS oracle 1463 OCT 10 03:41 generic_open.gif
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 opal
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 otn
-rw-r--r-- 1 SYS oracle 216 OCT 10 03:41 rollup_minus_dgray.gif
-rw-r--r-- 1 SYS oracle 215 OCT 10 03:41 rollup_plus_dgray.gif
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_1
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_10
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_11
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_12
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_2
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_3
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_4
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_5
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_6
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_7
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_8
drw-r--r-- 2 SYS oracle 0 OCT 10 03:41 theme_9
226 ASCII Transfer Complete
ftp> bye
221 QUIT Goodbye.
www:oraclexe[XE]>

(3) Disable FTP access for security:

www:oraclexe[XE]> sqlplus system@xe

SQL*Plus: Release 10.2.0.1.0 - on Sun Mar 19 22:24:28 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0

SQL> exec dbms_xdb.setftpport('0');

PL/SQL procedure successfully completed.

SQL> alter system register;

System altered.

SQL> exit


~Dietmar.

32 comments:

Anonymous said...

Hi Dietmar,

Thanks for your explanation. DBA and PL/SQL Developper but only batch.

It help me too.

Henri318

Anonymous said...

Hey Dietmar,

Thanks for this post, it helped me and i'm sure it helped many ohters too.

Stijn

Anonymous said...

Thanks a lot for this great post. I think this post must be insert in the official Oracle XE documentation.
Natale from ITA

Anonymous said...

Brilliant - just what I have been looking for! I have been searching the file system of my Linux for the files!

MrTree said...

Thanks for the very helpful post.
By the way, if you are using LINUX, the Nautilus file manager in Gnome is a good WebDAV client.

Anonymous said...

Thanks.

It's interesting to know :8080/i.
But I don't find my own pages created by APEX.

Unknown said...

Hi Anonymous,

the pages created by Apex are not stored in the filesystem or accessible via WebDav. These are merely entries in various database tables (just metadata).
They are rendered dynamically at runtime.

You can only access them via the application builder.

Regards,
~Dietmar.

Anonymous said...

I have Oracle Database 10g Express Edition installed on Windows XP.

I am unable to find a file named marvel.conf or dads.conf.

In addition,there does not appear to be an oracle/product/10.2.0/htmldb directory in my installation. I'm not sure if it is becuase I installed on XP instead of Linux.

Any additional feedback would be greatly appreciated.

Unknown said...

Well, you don't need any of these for a standard XE install.

I was referring in my post to a *standalone* Apex installation. This is a regular Oracle version (Enterprise or Standard Edition) plus an Oracle Apache (either the one that comes with the database or the one from the application server).

Do you have any problem?

Regards,
~Dietmar.

Anonymous said...

Last version of IE don't have the option of "Open as a Web Folder", or at least I can't find it.

But you can go to:
My Network Places -> Add Network Place ...
and follow the same instructions and finally you have a window to the directories that you want to modify/browse.

Joel.

Unknown said...

Well, IE 7 has the same dialog. Just go to File > Open and you will see the dialog.

Show screenshot

Then check "Open as web folder".

Regards,
~Dietmar.

Anonymous said...

Has anybody tried on Windows VISTA using WEBDAV as described above?
Thank you.

Shaun

Anonymous said...

Thank you, Dietmar, for your excellent solution to this problem! It worked! Outstanding job! Thank you.

Anonymous said...

Dietmar - Thanks so much for this tip. Too bad ORACLE does not document their products.

Mike

Anonymous said...

If i want a user to input a file with out having to go to Shared Components>Images to load files how can i have them load the file

Unknown said...

Yes how do you reference this image in code and allow it to be displayed

Unknown said...

Hi Kevin,

>Yes how do you reference this image in code and allow it to be displayed

There is no special syntax. If you want to reference the image favicon.ico in the folder i you would use the following image src="/i/favicon.ico" . That's it. It acts like a normal (simple) webserver.

Regards,
~Dietmar.

Unknown said...

Hi Anonymous,

>If i want a user to input a file with out having to go to Shared
>Components>Images to load files how can i have them load the file

You can build an upload form to load the images into the database.

Here is a good working example from Denes Kubicek.

Upload/download sample.

Make sure to implement the solution using the application process, it is more secure.

Regards,
~Dietmar.

Anonymous said...

Hallo Dietmar,

the same Problem exist in Update Oracle XE 10g (10.2.0) if you try to Update Apex 3.1.1.

Thanks to you i'v be able to solve this new Version of Apex again.

And importent to say, not only copy the *.gif, you have to copy all subfolders in ALIAS /i/.

And Importent, all Oracle directory Object's don't work on network drive and Windows mapped network shares.

Thanks

Unknown said...

Hi anonymous,

yes, it is the same procedure for new APEX versions, too.

But you can do the upgrade in an easier way when you just follow the upgrade instructions for XE:
http://www.oracle.com/technology/products/database/application_express/html/3.1_and_xe.html

There you see the command:
@APEX_HOME/apex/apxldimg.sql APEX_HOME

It will actually
a) rename the current /i/ directory in the XMLDB and#
b) upload all new files to the XMLDB repository (/i/)

Thus you don't have to follow the procedure as outlined in this post to upgrade the APEX version.

Regards,
~Dietmar.

Amol G said...

Resp,

sincerely Thanks for this post, it helped me and I'm sure it helped many others who currently troubling for this problem.

Amol

Anonymous said...

i want to convert HTML file (Bill Generated in HTML)to PDF.

Steffen Oliver Schulz said...

Hi Dietmar,

your explanation is extremely good and valid for all users that do not use Vista and IE7.

As in so many other circumstances, Vista is a litlle bit different:
Using Vista one must first install the Software Update for Web Folders (KB907306) - even with SP1 installed (at least I had to do it).
And second one must not use IE, but use the Windows Explorer instead and create a new network resource.

From there on everything works according to your description.

SOS

Unknown said...

Hi Steffen,

thanx for the helpful comment :).

I have skipped Windows Vista altogether. My next OS will bei either MAC OS, Ubuntu or Windows7, who knows ;).

Greetinx,
~Dietmar.

agfazzolari said...

Thank you for this very helpful post. I spent some time looking through the APEX and XML DB documentation to no avail. One minor, but very important, detail left out in the documentation is the fact that you need to use the SYSTEM user. You're a lifesaver!

Unknown said...

Hi Dietmar,

Once you've fininshed copying something in how do you turn this back off?

Tom

Unknown said...

Hi Tom,

usually you can find the WebDAV connection under "Network Places". You can delete it there but the credentials will be valid up until you reboot the machine I guess.

Why do you ask? What are you trying to accomplish?

Regards,
~Dietmar.

Unknown said...

Dietmar,

Thanks for the quick reply.

The reason for the question was just wanting to be sure there wouldn't be a hole left open from a security stand point. i.e. something that someone might be able to exploit.

Again, I do appreciate your quick response.

Tom

Unknown said...

Hi Tom,

well, if security is your concern then I would do the following, which I actually did for my own site www.opal-consulting.de ;)

*) Set up a plain Apache as a proxy to XE.
*) This way I can protect it better and there I keep the images in the filesystem for my APEX installation just as I would with a vanilla APEX installation using the mod_plsql.
*) Close down the ports with a firewall (I used a simple approach with iptables on my linux box), especially port 1521 for the database.
*) Use putty or any other ssh client to establish a tcp/ip tunnel for connecting to the database on port 1521.
*) The files I need in my APEX applications I do transfer using WinSCP or any other secure ftp client.

Regards,
~Dietmar.

Anonymous said...

Hi Dietmar,
Your tip still prove to be very useful.
Thanks for taking the time.

Regards,
Max.

Anonymous said...

Thank you very much. very useful post

Anonymous said...

Thanks for sharing this useful info.
One more obstacle overcome.

Rob K