Monday, November 14, 2011

Are we going to have jQueryMobile RC3 before 1.0?


I have subscribed to jquerymobile blog through Google reader. According to it jQueryMobile RC3 has been released, however this post is not yet available in jQueryMobile.com. Is that mean Google Reader, gives you sneak peek of posts before its been published?
This releases pushes Apex 4.2 since jQueryMobile is not production yet.



Sunday, November 13, 2011

Managing Apex Listener on Apache Tomcat

On my previous post I have blogged about installing Apex Listener on Apache Tomcat. In this post I will cover, creating Admin user for Apex Listener and managing it.

Reference: https://forums.oracle.com/forums/thread.jspa?threadID=2174509&start=15&tstart=0

Open up "tomcat-users.xml" file present in the <Tomcat Home>/conf location.
Add the following lines of code under tomcat-users element.


<tomcat-users>
 <role rolename="Manager"/>
 <role rolename="Admin"/>
 <role rolename="manager-status"/>
 <role rolename="manager-gui"/>
 <role rolename="manager-script"/>
 <role rolename="manager-jmx"/>
 <user username="apexStatus" password="apex Status Password goes here" roles="Manager"/>
 <user username="apexAdmin"  password="apex Admin Password goes here" roles="Admin,manager-status,manager-gui,manager-script,manager-jmx"/>
</tomcat-users>


Restart Tomcat and now you can access Apex Listener using

http://localhost:8080/apex/listenerAdmin

You can as well access administer Tomcat using the same password and following URL

http://localhost:8080/manager/
Perhaps you can use the same to deploy war files



Note: You must access Tomcat directly to gain access. If you are trying to access Tomcat through Reverse Proxy server like ISA or if you have internet facing Apache infront of Tomcat, you will not be able to gain access to Admin module. I learned it in a hard way.

I will blog about connecting to multiple Databases from single Apex Listener seperately.

Thursday, November 10, 2011

Running Oracle Apex Listener on Apache Tomcat

WARNING: This configuration is NOT supported by Oracle. You are risking it on your own.

Even though Oracle doesn't support Tomcat as one of the supported platform for Apex Listener, nothing stops you from trying it. Here are the steps to make it work.
Before you try, I assume you already have an Oracle database running with Apex installed on it.
If not you can download Oracle 11g R2 Express Edition from
http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
and Application Express from http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html

1. Download and install Apache Tomcat http://tomcat.apache.org/ I have used Tomcat 6.0 before and for this blog I am going to try it on Tomcat 7.0. I have installed it on "C:\Program Files\Apache Software Foundation\Tomcat 7.0" directory port 8080 on my PC. If you have installed successfully you should be able to access it from your browser using http://localhost:8080/


2. Download Apex Listener from Oracle OTN website.  Latest production version available while writing this blog was Apex Listener V 1.1.3.
http://www.oracle.com/technetwork/developer-tools/apex-listener/downloads/index.html

3. Extract the Apex Listener and copy "apex.war" file to the <Tomcat Home>/webapps directory. In my case "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps"

4. Open up your browser and start configuring Apex listener by accessing the URL listed below. Type in the password for APEX_PUBLIC_USER, verify database connection options and hit "Apply" button.
http://localhost:8080/apex/listenerConfigure

5. If everything goes well, you should be able to see a page similar to this. Don't freak out, Page is broken just because you haven't finished copying Apex images folder.




6. Tomcat webserver root folder is <Tomcat Home>\webapps\ROOT in my case "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT". I ended up copying Apex images folder to "i" folder under ROOT since "images" maps to "i" in apex. If you are trying it out in Unix/Linux you can avoid this step by creating a soft link to pointing to the images folder. After copying the images you should be able to access the same page with all the images successfully. If you got it correctly, CONGRATULATIONS, you have just configured Apex Listener on Apache Tomcat successfully.


I will cover Managing Apex Listener on my next blog post.

Tuesday, November 8, 2011

Open up Network access in Oracle 11g in 3 lines of code

If you want to quickly open up internet access to an Database User in Oracle 11g, here is the 3 lines of code you need to execute (Of course as SYSTEM or SYS)


BEGIN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('allow_access.xml','Allows Users to access internet using UTL_HTTP', 'SCOTT', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('allow_access.xml' ,' SCOTT', TRUE, 'resolve');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('allow_access.xml','*');
  COMMIT;
END;
/


This will allow DB User SCOTT to access any websites using UTL_HTTP.

Note: This is not advisable on a production and you may have to restrict access based on website and port.

More details at: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_networkacl_adm.htm

Thursday, November 3, 2011

Passing User credentials for Web Proxy server in UTL_HTTP

All most all corporates uses Web proxy server to allow their employees to access internet. This way they have great control on who gets to see what site etc. When you try to access a web page using IE it doesn't ask for the network user id and password however Firefox and Safari may ask for the same to send it over to the Proxy server.
UTL_HTTP helps us to consume web resources through PL SQL, it can as well accept Web Proxy Server to connect to the internet. However you will get an access denied error message if your Proxy Server requires user authentication.
You can overcome this by allowing HTTP requests from Database server in your Web Proxy server or by simply passing your user credentials while specifying the Proxy server in UTL_HTTP request like this.


SELECT UTL_HTTP.REQUEST('http://www.google.com','http://<Your Network ID>:<Your Password>@webproxy.yourcompany.com:<Port>') from dual

PS: By default web access using UTL_HTTP access is denied in Oracle 11g onwards. You need to create an ACL to allow the traffic flow through Oracle database.

If you don't know the Web proxy server, contact your network administrator or you can find the same from Internet Explorer Tools->Internet Options->Connections->LAN Settings page. If you use automatic configuration script, type that address directly on your browser and look inside that file to locate your Proxy server.

Finally you have to pass the user credentials to the proxy server and no to the website you are browsing (I often do this mistake).

References: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e25788/u_http.htm#ARPLS71019