Monday, July 21, 2008

Sqlplus on a Mac with Oracle Instant Client

One of the things any Oracle developer uses is sqlplus, but getting it to work on Mac OS-X is not quite as easy as on Windows. Follow these steps to install sqlplus on your Mac.

1. Download the Oracle Instant Client Zip files:
  • Instant Client Package - Basic
  • Instant Client Package - SQL*Plus
  • Instant Client Package - JDBC Supplement (Optional)
  • Instant Client Package - SDK (Optional)
2. Launch the Terminal and unzip the files to instantclient10_2.

unzip instantclient-basic-macosx-10.2.0.4.0.zip
unzip instantclient-sqlplus-macosx-10.2.0.4.0.zip
unzip instantclient-jdbc-macosx-10.2.0.4.0 #Optional
unzip instantclient-sdk-macosx-10.2.0.4.0 #Optional

3. Move the directory to where you want it. I put mine in /usr/local/oracle/instantclient_10_2.

sudo mkdir /usr/local/oracle/
sudo mv instantclient_10_2 /usr/local/oracle/

4. Then go to this directory and make symbolic links for dynamic libraries.

sudo ln -s libclntsh.dylib.10.1 libclntsh.dylib
sudo ln -s libocci.dylib.10.1 libocci.dylib

5. I reccomend creating a tnsnames.ora file where you add all your connection details. I placed mine in /usr/local/oracle/network/admin.

Example of a tnsnames.ora file:

IDENTIFIER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = userid.myhosteddb.net)(PORT = 1521))
)
(CONNECT_DATA = (SID = odb))
)

6. Then you need to set up necessary environment variables. I added mine to my .bash_profile script so they are alway's set when I run the terminal.

In your home folder you can type:


vi .bash_profile

And then add the following lines at the end of the file (Make sure you set the PATH correctly otherwise sqlplus won't run):

export DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient_10_2"
export SQLPATH="/usr/local/oracle/instantclient_10_2"
export TNS_ADMIN="/usr/local/oracle/network/admin"
export NLS_LANG="AMERICAN_AMERICA.UTF8"
export PATH=$PATH:$DYLD_LIBRARY_PATH

7. You should now be able to run sqlplus. Close the terminal and re-lunch it. Now run:

sqlplus [username]/[password]@[service]

8. Sqlplus should now run and look something like this:

Saturday, July 5, 2008

Oracle E-Business Suite on a Mac

One of my first concerns as a Oracle developer when considering switching to a Mac was if I would be able to access Oracle E-Business Suite. (Or Oracle Applications as many may know it by) Even though the official Oracle E-Business suite blog (http://blogs.oracle.com/stevenChan/2006/08/18/) clearly states that is supports it, I know from previous experience that it can be quite a mission to work with Jinitiator (the java tool required to access Oracle forms), especially if you are a consultant and move between different sites who uses different versions of E-Business, and more importantly different Jinitiator versions. From different versions of Jinitiators that clash, to Firefox that don't recognize it, to Internet Explorer crashing on me, I always had problems on Windows, so surely getting it to work on a Mac must be quite a mission right? Wrong! Since E-Business on a Mac only uses Java and no Jinitiator its a breeze to use, and I could access E-Business with Safari without doing anything, or installing any plugins!


Apps Login screen

Apps Navigation Menu


Find Concurrent Request


Shipping Transactions


Quoting Module


Workfow Monitor

After it was sooo easy to login to E-Business from Safari, I thought there is no chance of Firefox working so easily. I fired up Firefox and logged into E-Business again without having to install anything. Awesome!


Oracle Financials in Firefox

Something I did pick up though which is very annoying is the default assignments of the F-keys in Mac OS X. Since its the default way to search in E-Business with the F11-key, but in Leopard's System Prefrences its set to Desktop. The easiest way to get rid of this problem is to go to System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts -> Desktop, and deselect it.



My conclusion is that it is even easier to work on Oracle E-Business suite on Mac OS X than on Windows, and I would recommend any E-Business user who is thinking of switching, to seriously consider it!

Applications Versions Used:
Mac OS X Leopard: 10.5.3
Safari: 3.1.1
Oracle E-Business Suite: 11i
Java: build 1.5.0_13-119
Firefox: 3.0