Posts

Showing posts from 2015

Compiling Oracle code from Atom text editor

Image
Just yesterday I was watching a webinar titled: "Fill the Glass: Measuring Software Performance" which featured Jorge Rimblas. You can check out the video on Vimeo at the following URL:  https://vimeo.com/140068961 . It's just giving an insight into a project Jorge is working on, giving various tips here and there - so if you have a minute (rather, an hour) to spare, go and check it out. One of the sections that particularly caught my attention was the fact Jorge was able to compile packages from his editor of choice (which is Sublime text editor) (this happens at around the 18:20 mark). Because I like free (and open source) software, I actually use Atom text editor. Being centred around a plugin ecosystem, I was curious how he was able to do this - and if in fact I'd be able to accomplish the same, in Atom. So, first of all I did some hunting to see how it was done in Sublime. This led me to this great post by Tim St. Hilaire -  http://wphilltech.com/sublime-text

Making connections to the Oracle Database from Golang

I posted the other day about getting going with Golang[ 1 ], and as mentioned am planning to do a series of posts on various aspects of the language - as a means to help with the learning process. Being an Oracle developer, it seemed logical I would want to be able to make connections to the Oracle database. Built into the language core is an SQL interface (for issuing queries and statements) which is through the module "database/sql". The other side of it is that you need a valid driver. A list of available drivers is on the go wiki[ 2 ]. You will see that there are 2 listed for Oracle. How do I judge which project to use? First I see that one has considerably more stars and for another, the online commentary I see also seems to suggest that same package. And that is  https://github.com/mattn/go-oci8 . Driver setup Before we get to the driver, you need to make sure you have an Oracle client and the SDK installed on your system. For, this I followed the steps as per the

Oracle developer choice awards

From June 21, Oracle opened up nominations for what they have dubbed Oracle developer choice awards, in 5 broad categories: SQL PL/SQL ORDS APEX Database Design There has been a panel that has narrowed down the nominations from each category, and now the voting has opened up - until the 15th October.  You are able to vote for more than one person in each category, the rules don't specify how many votes in each category, but I would encourage selecting a few of the people you think are most deserving in the community and giving them an up-vote.  Please choose wisely, because the system doesn't allow you to undo your upvote - the only way to undo that vote, is to then down vote. So unless you feel very strongly that that person shouldn't be awarded and wish to down-vote them, I emplore you to choose wisely. The APEX candidates Jari Laine Very active of the OTN APEX forum, from well before I even started working with APEX. The time he has spent as

Prototyping usage of an OAUTH API

Image
There are many services out there that offer an OAUTH2 API - whereby you get an access token, associated to your account, and you use that with requests rather than logging in each request. It's a solid design, because for one, you as a user can opt to grant permission to parts of the system, and for another you can easily revoke access to individual applications. One problem? It is fairly unlikely there is a client library built for PL/SQL or APEX use. For instance, Google provides libraries for[ 1 ]: Java JavaScript .NET PHP Python Objective-C Another example, Instagram provides[ 2 ]: Python Ruby It's not too hard to build it in PL/SQL once you understand the flow of OAUTH. I started working on one for Google services, which is hosted over on my GitHub profile. Before you get too far with that though, you may like to test the requests you are attempting to work with. The one's I have seen tend to provide an API test tool, however you may like to create

My experience as an Oracle developer running Ubuntu

Image
If you have been following my blog, you may have noticed the desktop environment I use is the Ubuntu distribution of Linux. Growing up, I always tried Linux here and there, but never stuck with it - it was more just to try out. As with anything, if you are going to use something new, you really have to commit to it - pick a period of time you are willing to use it for, and see how you go. If you still don't like it at the end, go back into your old ways. (I will add that I did once upon a time own a Mac. Actually, I purchased a Powerbook right before Apple made the switch to the Intel CPU architecture. I know Mac OS X seems quite popular in the development community nowadays, however I still prefer to be able to select my hardware, and I believe I get that freedom and also get a bit of Software freedom by running Linux.) At around 2008 - actually, soon after I started working with APEX - I had a couple of colleagues that were running Ubuntu. Since I started developing with Or

Building an Oracle 11G XE Server with APEX 5, ORDS and SQLcl in 30 minutes

Image
Pre-requisites 1. You have VirtualBox installed 2. You have the necessary Oracle installation files (oracle-xe, apex5, ords3 and sqlcl) Oracle XE - download from:  http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html Apex 5 - download from:  http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html ORDS 3 - download from: http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html SQLcl - download from:  http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html 3. You have the installation image for CentOS - I just grabbed the Minimal image from a local mirror -  http://centos.mirror.digitalpacific.com.au/7/isos/x86_64/ Set up the virtual machine Give the Virtual machine an appropriate name, and since CentOS is based off Red Hat, specify the type as Red Hat (64-bit). Allocate 1GB RAM Create a new virtual hard drive (for this demo, I

Building ORDS plugins

Image
Oracle Request Data Services (ORDS) released version 3 recently. If you didn't notice, this version allows you to develop plugins (with Java) that can be imported into your ORDS instance, and provide extended functionality. You want to refer to the Oracle REST Data Services Plugin API, located here:  http://download.oracle.com/otndocs/java/javadocs/3.0/plugin-api/index.html , which itself includes a couple of nice documents: Getting started guide Developer guide This post just re-iterates a lot of what has already been covered in the getting started guide, with a focus on using IntelliJ IDEA. Setting the project up in IntelliJ IDEA So the first step is to set up a new project. First however, you will want to verify what version of Java you are using on your server (assuming you are developing on a separate workstation). This can be verified with the command java -version. [user@host ~]# java -version java version "1.7.0_79" OpenJDK Runtime Environment (rh

Building dynamic forms

How do I build a dynamic form? Well first, you need to have your questions stored somewhere, so we set up the following (basic) model: CREATE TABLE DYNAMIC_QS( ID NUMBER PRIMARY KEY, QUESTION_KEY VARCHAR2(20) NOT NULL, QUESTION_TYPE VARCHAR2(20) NOT NULL, QUESTION_SEQ NUMBER NOT NULL ); / CREATE TABLE DYNAMIC_ANS( ID NUMBER PRIMARY KEY, QUESTION_KEY VARCHAR2(20) NOT NULL, QUESTION_ANS VARCHAR2(4000) NOT NULL ); / create sequence dynamic_qs_seq; / create or replace trigger BI_DYNAMIC_ANS before insert on DYNAMIC_ANS for each row begin :NEW.ID := dynamic_qs_seq.nextval; end BI_DYNAMIC_ANS; / insert into DYNAMIC_QS values (1, 'NAME', 'TEXT', 10); insert into DYNAMIC_QS values (2, 'AGE', 'TEXT', 20); insert into DYNAMIC_QS values (3, 'ADDRESS', 'TEXTAREA', 30); / create or replace view v_dynamic_qs as select dynamic_qs.id , dynamic_qs.question_key , dynamic_qs.question_type , dynamic_ans.quest

Deploying individual components

Image
The scenario is you have two (or more) environments, some changes are ready from the development environment and others aren't - so you can't deploy the whole application, because some components are broken. Yes, you could employ the use of build options to prevent any issues happening, and only enable components when they are ready, but what other options are there? Well, APEX has functionality to export pages and individual components. So for one example, you've been good and kept the schema name, workspace names consistent. You also maintained the same application ID amongst environments. So, you do an page export from one environment, and try to import it to the other, but you receive the following error: This page was exported from a different application or from an application in different workspace. Page cannot be installed in this application. These components were exported from a different application or from an application in a different workspace. The c

APEX 5 Give me Interactive Reports

Image
One of the statements of direction for APEX 5 is multiple interactive reports on a single page. Multiple Interactive Reports – Allow any number of Interactive Reports to be defined on a single page. So, time to explore that functionality. One pattern I've used in the past is loading particular saved reports (rather than the default primary report). You may have some pre-defined filters, a row highlight, specific columns. So for demonstrations, I've built an IR on the emp table. Then I go and apply some filters, and save an alternate report: Then in the page designer assign an alias to that report. As you can see, that allows me to enter in the request portion of the URL: IR_SAL_TOTAL. However, if we add a second IR to the page and try to access that saved report, we would receive an error "Report does not exist". This is because it tries to find that that report name in both IR's. To get around this, you MUST  set a static ID property fo

Identifying functions and procedures without arguments

I wanted to find a report on all procedures in my schema, that accepted zero arguments. There are two views that are useful here: USER_PROCEDURES USER_ARGUMENTS With USER_PROCEDURES, if the row is referring to a subprogram in a packaged, object_name is the package name, and procedure_name is the name of the subprogram. With any other subprogram out of the context of a package, the object_name is the name of the subprogram and procedure_name returns NULL. With user_argument, object_name becomes the name of the subprogram, with package_name being NULL when you are not dealing with a package's subprogram.  In the case of subprograms out of the package context, no rows are returned in the user_arguments  view. That differs from a subprogram in a package - you get a row, but argument_name is set to NULL. You will never get a NULL argument if there is at least one argument. In the case of functions, you will get an additional argument with argument_name set to NULL th

Reset an Interactive Report (IR)

Image
To reset an IR back to the default settings, you may know you can go to the actions menu, and hit reset: If you inspect the apply button you will see it's calling gReport.reset() And there are a bunch of examples using this gReport object both for resetting the report and other IR functions. https://community.oracle.com/thread/2186564 https://community.oracle.com/thread/2595066 http://www.apex-at-work.com/2010/03/building-ir-filters-with-ajax-not.html http://www.apexninjas.com/blog/2012/06/the-greport-search-function-for-apex-interactive-reports/ The problem? This is not documented, and with APEX 5 supporting multiple IRs, this will no longer work. In your console, if you enter gReport, you will see that object no longer exists. The other technique you can use is the clear cache portion of the URL. According to the docs : To reset an interactive report in a link, use the string "RIR" in the Clear-Cache section of a URL. This is equivalent to the