Archive for the ‘Oracle’ Category
SQL*Loader-704 Error
While using Oracle’s SQL Loader utility the other day, I ran into a subtlety which wasn’t obvious. Most of the documentation out there describes the userid param as just taking user/pass. But it actually can take the user/pass@SID form as well. If you get an exception message something like the following:
SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12541: TNS:no listener
try qualifying your sqlldr command with .world:
so
sqlldr userid=user/pass@yourSID control=test.ctl
becomes
sqlldr userid=user/pass@yourSID.world control=test.ctl
Oracle Mix: First Public JRuby on Rails is Launched
Oracle Mix is a joint effort between the folks at Thoughtworks and Oracle to provide a community for Oracle clients to exchange ideas and network with each other and Oracle.
Connecting to Oracle from Rails
Since there are several variations of docs on this (some of which are out of date) I figured I'd document this.
- Download and install the Ruby interface from http://rubyforge.org/projects/ruby-oci8/
- Then, in your config/database.yml file, you should have something like this:
-
development:
-
adapter: oracle
-
database: <your-sid-here>
-
host: //<your-host-here>:<your-port-here>
-
username: <your-username-here>
-
password: <your-password-here>
If you're running Rails with JRuby you should have the Oracle JDBC drivers in the classpath and the entry above will be a little different:
-
common: &shared
-
adapter: jdbc
-
driver: oracle.jdbc.driver.OracleDriver
-
url: jdbc:oracle:thin:@<your-host-here>:<your-port-here>:<your-sid-here>
-
username: <your-username-here>
-
password: <your-password-here>
-
-
# oracle (JDBC)
-
development:
-
<<: *shared
Installing Oracle Instant Client on Mac OS X
Getting right down to business...
- Download the Instant Client Packages (4 files)
- Unzip the files into
instantclient10_1CODE:-
unzip instantclient-basic-macosx-10.1.0.3.zip
-
unzip instantclient-sqlplus-macosx-10.1.0.3.zip
-
unzip instantclient-sdk-macosx-10.1.0.3.zip
-
unzip instantclient-jdbc-macosx-10.1.0.3.zip
-
- Create two symbolic links for the files that have the version appended. This is so the Ruby
OCI8driver can find what it’s looking for.CODE:-
cd instantclient10_1
-
ln -s libclntsh.dylib.10.1 libclntsh.dylib
-
ln -s libocci.dylib.10.1 libocci.dylib
-
cd ..
-
- Create directory
/usr/local/oracleand then copyinstantclient10_1into itCODE:-
sudo mkdir /usr/local/oracle
-
sudo mv instantclient10_1 /usr/local/oracle/instantclient10_1
-
- Open the system
/etc/profile
sudo pico /etc/profile - Add these lines to
/etc/profileCODE:-
DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient10_1"
-
export DYLD_LIBRARY_PATH
-
SQLPATH="/usr/local/oracle/instantclient10_1"
-
export SQLPATH
Add
/usr/local/oracle/instantclient10_1to yourPATHwhile you have/etc/profileopen. Then save it. -
- Reload your profile
source /etc/profile
- Test it out with the
sqlpluscommand line app.CODE:-
sqlplus [username][/password]@//[hostname][:port][/database]
-
If you can connect with that, then you’re good to go.
