Friday, November 19, 2010

APEX Meetup @ UKOUG 2010

As more or less a tradition, there will be an APEX Meetup during the upcoming UKOUG. Ben (a.k.a. Munky) was so good to organize this social gathering of APEX enthousiasts. 

Venue: Pennyblack's at The Mailbox -  http://www.pennyblacksbar.com

Time: Monday 29th November arrive 8:00pm - 8:30pm

He needs to give a rough confirmation of numbers by the start of next week. So if you are in the neighborhood and would like to attend (and who wouldn't), please leave a comment on this post!

Thursday, November 18, 2010

UKOUG Conference right around the corner!

Booked my flight : 
Made a reservation for my hotel : 
Picked sessions for those three days : 

See my (ambitious) schedule below...really looking forward to it!

Wednesday, November 17, 2010

Chatting with the database

At APEXPosed in Brussels I attended a presentation by Lucas Jellema called "Reaching out from PL/SQL". It was all about leveraging the central position of the Oracle database in the application architecture. Of course the examples were accompanied by some fine demo's. One of them was sending and receiving email by the database: You could ask the database a question, and the database answered that one. Another one was sending instant messages from the database when some data was changed. Interesting stuff!
So I decided to combine those two: Why not chat with the database? Ask the database a question using an IM client and the database will (try to) answer to that question...

I started off with downloading and installing the Oracle-XMPP code (XMPP stands for Extensible Messaging and Presence Protocol). Because I needed my own XMPP-server, I also downloaded and installed OpenFire. One of the options when installing OpenFire is to use an Oracle Database for storing the data (using a OJDBC driver). In the OpenFire schema there is a table called ofoffline, used to store messages send to users that are offline. By defining a user (called 'oracle'), that is always offline, I can get "my" messages there. I also wrote a trigger on that table to handle the requests. And the result is someting like this:
How cool is that?
Of course you can (and should) modify the parsing of the query to make it more userfriendly - and not vulnerable to SQL-Injection. But you can chat with your database using this stuff!

Monday, November 08, 2010

The trouble of getting APEX on MySQL to work...

In theory it should be so easy...running an APEX application on an Oracle instance with database links to MySQL for retrieving and modifying data. In theory that is, because in practice it is somewhat more cumbersome. I finally got there, but it took some steps  - and patience...

I started off with the steps provided from a couple of websites. Like these from Birijan, from Pythian, from WebAJ and from Easysoft. They´re all not the most recent ones, so I downloaded the latest versions of MySQL (5.1.51), MySQL Connector for ODBC (5.1.7) and unixODBC (2.3.0) and installed this stuff on top of the Oracle Developer Days Virtual Machine. Following the steps provided on the sites earlier mentioned I had a MySQL database with a demo table within minutes. So far so good!

After changing the odbcinst.ini, odbc.ini, tlistener.ora, tnsnames.ora and the initmysql.ora (in $ORACLE_HOME/hs/admin) file I fired up SQL*Plus and created a databaselink using 
create database link mysql
  connect to "demo"
  identified by "demo"
  using 'mysql';
So I expected a nice return set when I entered
select * from "employees"@mysql;
But instead of a list of employees I got this (very unclear) message:
ERROR at line 1:
ORA-28500: connection from ORACLE to a 
non-Oracle system returned this message:
[
So I Googled around, tried this and that, traced everything traceable. But still couldn't get any other result than the ORA-28500. So I turned to the forum for help, which resulted in this thread. In the last post you can see what the (simple) solution was: in the initmysql.ora (or whatever that file is called), I had a line for the language/region/characterset setting and there was a very tiny typo ...
HS_LANGUAGE=AMERICAN.AMERICA.WE8ISO8859P15
should be
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P15
So from that moment on, I could enter a SQL statement in SQL*Plus and retrieve data from my MySQL database! But the happiness didn't last that long ;-(
Over and over and whatever I tried, I only retrieved just one row from my employees table - the first one according to the ordering of the result set. And sometimes even I just got one - the first - column back, and the other columns where just "gone"....

So, again, I called to the Oracle Forums to the rescue, which resulted in this thread. Again, a lot of tracing and after some time it seemed to be a problem in the version of the MySQL ODBC Connnector, because version 5.1.7 didn't work (and 5.1.0 had the same problem), while 5.1.5 did work. So I deinstalled my current version and reinstalled the previous GA version: 3.51.27. And from that moment on it worked flawlessly! I could query, insert, update and delete records in my MySQL database from Oracle without a hitch.

The last step - using an APEX application to do the data manipulation - is well written by Ilmar Kerm in this blog post, including some code to implement optimistic locking and to overcome the ORA-02047 error. And now - finally - I got an APEX application running on MySQL (in fact, it stills runs on Oracle, but uses MySQL data of course).

So after all you can do it in an hour or two:
- if you don't make any stupid typos and
- if you're "lucky" enough to use (or get) the working drivers immediately!

Monday, November 01, 2010

First European OPP / APEXposed

Last week the first European OPP / APEXposed ever was held in Brussels. And just like the US originals - which I actually never was able to attend - this also was a huge success, when you listen to all the positive feedback and comments issued in the hallways of the Brussel's Sheraton. 
In two days there were 9 sessions to attend in 4 to 5 tracks. And even which such a relative small number of tracks it was hard to pick just one...so many interesting presentations!
APEXposed kicked off with a keynote by Patrick Wolf, in which he addressed all the nice new APEX 4.0 features at a glance. All of these features deserved a presentation on their own, and luckily most of them got one during the conference. Next I attended a session by Steven Feuerstein (he did 8 ! in these two days) about PL/SQL for APEX Developers. The key thing here was: develop your application as it was a regular PL/SQL based application, so use packages, test thoroughly, handle your errors well and code as less PL/SQL as possible in the APEX front end itself. Next was John Scott's scalability presentation. I have seen that one before, but it's still impressive if you see how to reduce the number of HTTP calls from 46 to 3 and the size of an HTML page from almost 500 kB to less than 10kB, by just using standard APEX and Apache features, like browser cache and webserver compression! Then Carsten Czarksi came on stage to explain how Java - in the database - can come to the rescue when PL/SQL isn't capable of handling the requirements, like getting the contents of a directory in PL/SQL. The last one of the day was by Niels de Bruijn about Migrating Oracle Forms and MS Access to APEX. An interesting subject, as I see more customers asking for the (im)possibilities of this kind of migration. Migration as such doesn't cover the contents entirely, as Niels and his team just kept the database structure in tact and rewrote the front end completely in APEX - while trying to adhere as much as possible to the layout and look-and-feel of the originating application.
The second day for me started with two very good presentations by Lucas Jellema about SOA for PL/SQL Developers and Reaching out from PL/SQL. The last one was how you can use PL/SQL - and the standard database features - to serve your clients well, like providing a service to show information on data changes in a table in RSS format and API services as views and PL/SQL packages. Lucas even demoed an e-mail and a Google Talk interface to the database, which looked pretty slick. The first presentation was aimed at defining the importance of the database, and thus PL/SQL, in a SOA environment. According to Lucas, not the ESB is the cornerstone of a SOA solution, but the database! And from experience 80 to 90% of all interaction in a SOA environment run through the database. So that's were the work should be done. A very good reassurance for all PL/SQL developers in the room!
After - again a very good - lunch, Carsten did his second presentation. This time on Unstructured Data in the Database. He explained about SecureFiles, Oracle Database File System, Oracle Text and the MultiMedia features - like the ORDIMAGE datatype. Very interesting and lots of nice demo's. Then, almost the last session, I delivered my Google Visualizations in APEX presentation.Went ok, I guess: all demo's ran fine and I ended right on time! The plugin(s) are downloadable from apex-plugin.com. For those who are interested, but weren't able to attend (and cannot download the presentations), I uploaded my presentation to Slidehare.
The last session was a very funny APEX quiz, by John and Dimitri. 30 questions, some easy, some though, more or less about APEX. Peter Raganitsch was a clear winner - and I ended op 4th (thanks for the $25 Amazon voucher, ODTUG!).
All in all it was a very good two days worth of spending time. Met some old friends and made some new - also a very important aspect of these get-togethers. And worthwhile repeating in 2011!
Thanks Dimitri, Steven and ODTUG for organizing this!