Get it here! Perl DBD::Sybase 1.14.01 for Active State Perl 5.16 Windows XP/Vista/7/8 32bit AND 64bit

Assuming that you installed Sybase SDK OpenClient 15.7.

Sybase Openclient is included in the Sybase Developer’s Kit, and ASE PC Client. If you don’t have a license, you can download the ASE 15.7 Developer Edition for Windows which will include it.

Install ActiveState Perl from http://www.activestate.com (free) and install DBI if it isn’t already installed.  It should be but you never know…

  1. Start -> ActiveState Perl -> Perl Package Manager
  2. install DBI
  3. exit

Now, the easy part.  Install the DBD-Sybase-1.14 1.14 PPM:

  1. download DBD-Sybase-1.14
  2. extract zip file to temporary directory (e.g. c:\test)
  3. Start -> Run -> cmd.exe (as Administrator if Vista or Windows 7)
  4. cd \test
  5. ppm install DBD-Sybase.ppd
  6. exit

That’s it :)

It should automatically install the DBD::Sybase for Perl 5.16 32bit or 64bit depending on which version of Active State Perl you have installed.

UPDATE (March 6th, 2013):

The PPM is fixed now. Please let me know of any issues.

Share Button

Installing Oracle Instant Client and DBD::Oracle on Ubuntu Linux 8.04 Server JEOS

Ever want to just install the minimal amount of Oracle client software for client applications on Linux? Well, Oracle has provided Oracle Instant Client to do this but they have neglected to make it intuitive to install. I’ve written a couple scripts that make it easy on Linux. I’ve tested this on Ubuntu Linux 8.04 Server JEOS.

Download the files you need

Download Oracle Instant Client

Retrieve the Instant Client packages and save them to a directory (e.g. “linux 32bit”).

  • Instant Client Package – Basic
  • Instant Client Package – JDBC Supplement
  • Instant Client Package – SQL*Plus
  • Instant Client Package – SDK
  • Instant Client Package – ODBC

Download DBD::Oracle and place it in the build-cfg directory

Copy your tnsnames.ora file into the build-cfg directory

Download build_oracle_instantclient.sh into the directory above build-cfg directory

Save root.sh into the build-cfg directory

Build a tar ball containing everything we need in the directory format we need.

build_oracle_instantclient.sh "../linux 32bit"

Script1: build_oracle_instantclient.sh

SOURCE_DIR="$1"
BUILD_DIR=builddir
CFG_DIR=build-cfg

if [[ -z $1 ]]; then
  echo "Usage: build_oracle_instantclient.sh <directory containing oracle instant client zip files>"
  exit 1
fi

if [[ ! -d "${SOURCE_DIR}" ]]; then
   echo "${SOURCE_DIR} is not a directory"
   exit 1
fi

find "${SOURCE_DIR}" -name "*.zip" -type f -exec unzip {} \;

if [[ -d instantclient_11_1 ]]; then
  TMP_DIR=instantclient_11_1
elif [[ -d instantclient_10_2 ]]; then
  TMP_DIR=instantclient_10_2
else
  echo "unable to determine extraction dir"
  exit 1
fi

if [[ -d ${BUILD_DIR} ]]; then
  rm -rf ${BUILD_DIR}
fi

mkdir -p ${BUILD_DIR}
mkdir -p ${BUILD_DIR}/bin
mkdir -p ${BUILD_DIR}/doc
mkdir -p ${BUILD_DIR}/java
mkdir -p ${BUILD_DIR}/lib

cp ${CFG_DIR}/* ${BUILD_DIR}
mv ${TMP_DIR}/*README* ${BUILD_DIR}/doc
mv ${TMP_DIR}/*.html ${BUILD_DIR}/doc
mv ${TMP_DIR}/*.htm ${BUILD_DIR}/doc
mv ${TMP_DIR}/lib* ${BUILD_DIR}/lib
mv ${TMP_DIR}/*.jar ${BUILD_DIR}/java
mv ${TMP_DIR}/sdk ${BUILD_DIR}
mv ${TMP_DIR}/* ${BUILD_DIR}/bin

cd ${BUILD_DIR}/lib
ln -s libclntsh.so.* libclntsh.so
ln -s libocci.so.* libocci.so
ln -s libsqora.so.* libsqora.so

cd ..
tarball=`echo ${SOURCE_DIR} | tr ' ' '-'`
tarball=`basename ${tarball}`
tarball=Oracle-${TMP_DIR}-${tarball}
tar cvf - * | gzip -9c > "../${tarball}.tgz"

cd ..
rm -rf ${BUILD_DIR} ${TMP_DIR}

Once we have the tar ball, we can copy that file to any compatible Linux system, extract it and run the root.sh file which will copy the install to /usr/local/oracle/InstantClient, set up the system variables and build DBD::Oracle for you.

Script2: root.sh

#!/bin/bash

############################################
function copy_instantclient () {
  if [[ `pwd` != "/usr/local/oracle/InstantClient" ]]; then
    if [[ ! -d /usr/local/oracle/InstantClient ]]; then
      echo "Creating /usr/local/oracle/InstantClient directory"
      mkdir -p /usr/local/oracle/InstantClient
    fi

    echo "Copying Oracle Instant Client to /usr/local/oracle/InstantClient" 
    cp -Ra * /usr/local/oracle/InstantClient
  fi
}

#---------
function update_etc_profile () {
  if [[ -f /etc/profile ]]; then
    if [[ `grep -c "ORACLE_HOME" /etc/profile` = 0 ]]; then 
      echo "Updating /etc/profile"
      cat >> /etc/profile < < EOF
  export ORACLE_HOME=/usr/local/oracle/InstantClient
  export TNS_ADMIN=\${ORACLE_HOME}
  export PATH=\${ORACLE_HOME}/bin:\${PATH}
  export CLASSPATH=\${ORACLE_HOME}/classes:\${CLASSPATH}
  export LD_LIBRARY_PATH=\${ORACLE_HOME}/lib:\${LD_LIBRARY_PATH}
  export SQLPATH=\${ORACLE_HOME}/bin
EOF
    else
      echo "Updates to /etc/profile already applied"
    fi
  fi
}

#---------
function update_library_cache () {
  if &#91;&#91; -d /etc/ld.so.conf.d &#93;&#93;; then
    if &#91;&#91; -f /etc/ld.so.conf.d/oracle_instant_client.conf &&  `grep -c "/usr/local/oracle/InstantClient" /etc/ld.so.conf.d/oracle_instant_client.conf` != 0 &#93;&#93;; then
       echo "Updates to /etc/ld.so.conf.d/oracle_instant_client.conf already applied"
    else
      echo "Updating /etc/ld.so.conf.d/oracle_instant_client.conf"
      echo "/usr/local/oracle/InstantClient" > /etc/ld.so.conf.d/oracle_instant_client.conf
      /sbin/ldconfig
    fi
  else
    if [[ `grep -c "/usr/local/oracle/InstantClient" /etc/ld.so.conf` == 0 ]]; then
      echo "Updating /etc/ld.so.conf"
      echo "/usr/local/oracle/InstantClient" > /etc/ld.so.conf
      /sbin/ldconfig
    else
      echo "Updates to /etc/ld.so.conf already applied"
    fi 
  fi
}

#---------
function print_env () {
  echo "Add the following to the rc.d script for any daemon processes that need to access Oracle.  For example, apache"
  echo '  export ORACLE_HOME=/usr/local/oracle/InstantClient
  export TNS_ADMIN=${ORACLE_HOME}
  export PATH=${ORACLE_HOME}/bin:${PATH}
  export CLASSPATH=${ORACLE_HOME}/classes:${CLASSPATH}
  export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
  export SQLPATH=${ORACLE_HOME}/bin'
}

#---------
function install_DBD-Oracle () {
  echo "Building DBD::Oracle"
  DBDORA=`ls DBD-Oracle-*`

  if [[ -f ${DBDORA} ]]; then
    tar zxf ${DBDORA} 
    cd DBD-Oracle* 
    TMP_DBDORA=`pwd`
    TMP_DBDORA=`basename ${TMP_DBDORA}`
  	perl Makefile.PL -m $ORACLE_HOME/sdk/demo/demo.mk
    make && make install
    cd ..
    rm -rf ${TMP_DBDORA}
  else
    echo "Unable to find DBD-Oracle file"
  fi
}

############################################

export ORACLE_HOME=/usr/local/oracle/InstantClient
export TNS_ADMIN=${ORACLE_HOME}
export PATH=${ORACLE_HOME}/bin:${PATH}
export CLASSPATH=${ORACLE_HOME}/classes:${CLASSPATH}
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
export SQLPATH=${ORACLE_HOME}/bin

copy_instantclient
update_etc_profile
update_library_cache
print_env
install_DBD-Oracle

Share Button

How to start DBArtisan when you have Sybase Openclient 15 installed

It may not be commonly known, but Embarcadero’s DBArtisan (a database management tool) will NOT work with Openclient 15.  Did you know that there is a way for you to enjoy Openclient v15 and DBArtisan?  This will allow you to retain the system wide settings for v15 of Sybase Openclient:

  • You need to install v12.5 Openclient (or just copy the %SYBASE% directory from a machine with Openclient v12.5 installed). 
  • Create a text file called DBArtisan.cmd , replacing the paths and the name of the dbartisan executable as necessary:

 

@echo off
set SYBASE=C:\Sybase12.5
set SYBASE_OCS=OCS-12_5
set SYBASE_SYSAM=SYSAM-2_0
set SYBROOT=C:\Sybase12.5
set SYBASE_JS=JS-12_5
set SYBASE_JRE=C:\sybase12.5\Shared\Sun\jre142

start "C:\Program Files\Embarcadero\DBA813" DBArt813.exe
  • Create a short cut to the DBArtisan.cmd file with the right clicking on the file and choosing "Create Shortcut"
  • If you want the shortcut to use the same icon as DBArtisan:
  • right click on the file, choose "Properties"
  • "Change Icon"
  • Replace text with "%ProgramFiles%\Embarcadero\DBA813\DBArt813.exe" or wherever your DBArtisan executable is
  • Choose the icon and hit "OK"

 

Share Button