Saturday, March 29, 2014

Installing Oracle Apex Listener (now called Oracle REST Data Services)

A client was having problems with the APEX Embedded PL/SQL Gateway (now there's a surprise) and asked if I knew how to install the APEX listener. Basically my answer was no.

Anyway, I decided I'd better move with the times so went to download the APEX Listener only to find Oracle have renamed it to Oracle REST Data Services for some reason.

So I downloaded this instead : http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html

It's quite a small file, and once downloaded I thought a good place to put it would be in the $ORACLE_HOME. It can go anywhere, but it's probably easier to put it somewhere you'd expect to look.

I copied it to $ORACLE_HOME/ords and extracted it there.

The install is very easy, just follow the instructions, but there were a couple of things I had to fix.

Since this is in a VM on my PC, I ran it in Standalone mode and followed these instructions: http://docs.oracle.com/cd/E37099_01/doc/doc.20/e25066/install.htm#AELIG7022

Before going ahead, you might want to do some preparation:

Connect to the database as sys and unlock the APEX_PUBLIC_USER account and change the password, because it asks you for this when you install REST Data Services. You night also want to run apxchgpw.sql to set the APEX admin password - use a temporary one because you will need to change it when you first login to the web page. You also need to make it reasonably complex or it will just exit.

So, once the ords zip file is extracted, run "java -jar ords.war"
It will run through some prompts, most should be obvious.

Enter the location to store configuration data:
I used "/u01/app/oracle/product/12.1.0/rest"

Enter the name of the database server: - I used localhost

Enter the database listen port - I used 1521

Enter 1 to specify the database service name, or 2 to specify the database SID [1]: - I used "1" and entered the SERVICE_NAME of the database

Enter the database user name [APEX_PUBLIC_USER]: - I let this default and put in the password I set earlier for the next 2 prompts.

Enter the database password for APEX_PUBLIC_USER:
Confirm password:

Enter 1 to enter passwords for the RESTful Services database users...
I entered "2" to use the same password. Obviously in a PROD environment you wouldn't do this, would you?

Enter 1 if you wish to start in standalone mode or 2 to exit [1]: - I entered "1"

Enter the APEX static resources location or Enter to skip: - Don't skip this. I don't know why they give you the option, because if you do the APEX login page will be blank.
I skipped this the first time round, and the APEX page was blank. I've seen this before in ealier versions, it means you haven't defined the images location.
So for this prompt, you need to enter the location of the APEX images, usually
"/u01/app/oracle/product/12.1.0/dbhome_1/apex/images".

Enter the HTTP port [8080]: - Pick a port. I used 8888 because a lot of the time 8080 is in use. Make sure any firewalls allow this port access.

That's it. The installer will go and do some stuff, then will tell you where the login page is : 
INFO: http://localhost:8888/ords/ started.
Note that the terminal window is now locked to this process.

Go to a browser and type in the URL. If all is well, you'll be presented with the APEX login page - use INTERNAL as the workspace and ADMIN as the user and the password you set earlier - and it will prompt you to change it.

So that's it. I'm not sure the benefits of this method over the EPG, but it looks as if it's the way Oracle is going, so you may as well use it.

Oh, it didn't work for me the first time. When I first went to the URL I got "service unavailable", but the feedback told me what was wrong "Account is Locked", so I unlocked the APEX_PUBLIC_USER account and that fixed it. The other thing was the page was there but it was completely blank, so I had to delete the files, re-extract the zip file and then use the "images" directory for the "static resources" prompt as mentioned earlier.

Happy APEXing.







No comments:

Post a Comment