How to Connect to Sybase

Read first the Connection dialog page to understand the dialog fields( host, port, user, etc. ), SSH tunnel, etc..

Connect to Sybase like in the image below. The administrative Sybase user is DBA with password 'sql', default database demodb.

Connect to Sybase

Tip Firewalls & anti-viruses may block database connections. Read How to enable Firewall connections.

Install Sybase on Ubuntu Tutorial

  • For a good tutorial look on http://community.jboss.org/wiki/InstallSybaseASEonFedora
  • Install required libraries
    sudo apt-get install libaio1
  • Enable more memory usage. Edit /etc/sysctl.conf and add the following line:
    kernel.shmmax=87108864
    Reload configuration using
    /sbin/sysctl -p
  • Create user sybase
    sudo useradd --base-dir /opt --create-home --system --comment "Sybase Adaptive Server" sybase
  • Allow Sybase to use XServer
    xhost SI:localuser:sybase
  • !!! LOGIN AS SYBASE. DON't do su, just start a new session
  • Download Sybase ASE from http://www.sybase.com/ase_1500devel. Install the software
    tar -xvf ase1503_lunxx86.tar.gz
  • Edit profile file .bash_profile
    . ~/SYBASE.sh
  • Copy the content below in a file adaptive_server.rs
    sybinit.release_directory: USE_DEFAULT
    sybinit.product: sqlsrv
    sqlsrv.server_name: SYBASE
    sqlsrv.new_config: yes
    sqlsrv.do_add_server: yes
    sqlsrv.network_protocol_list: tcp
    sqlsrv.network_hostname_list: localhost
    sqlsrv.network_port_list: 5000
    sqlsrv.application_type: USE_DEFAULT
    sqlsrv.server_page_size: USE_DEFAULT
    sqlsrv.force_buildmaster: no
    sqlsrv.master_device_physical_name: /var/lib/sybase/master.dat
    sqlsrv.master_device_size: 45
    sqlsrv.master_database_size: 26
    sqlsrv.errorlog: USE_DEFAULT
    sqlsrv.do_upgrade: no
    sqlsrv.sybsystemprocs_device_physical_name: /var/lib/sybase/systemprocs.dat
    sqlsrv.sybsystemprocs_device_size: 146
    sqlsrv.sybsystemprocs_database_size: 146
    sqlsrv.sybsystemdb_device_physical_name: /var/lib/sybase/systemdb.dat
    sqlsrv.sybsystemdb_device_size: 6
    sqlsrv.sybsystemdb_database_size: 6
    sqlsrv.tempdb_device_physical_name: /var/lib/sybase/tempdb.dat
    sqlsrv.tempdb_device_size: 100
    sqlsrv.tempdb_database_size: 100
    sqlsrv.default_backup_server: USE_DEFAULT
    #sqlsrv.addl_cmdline_parameters: PUT_ANY_ADDITIONAL_COMMAND_LINE_PARAMETERS_HERE
    sqlsrv.do_configure_pci: no
    sqlsrv.sybpcidb_device_physical_name: PUT_THE_PATH_OF_YOUR_SYBPCIDB_DATA_DEVICE_HERE
    sqlsrv.sybpcidb_device_size: USE_DEFAULT
    sqlsrv.sybpcidb_database_size: USE_DEFAULT
    sqlsrv.do_optimize_config: no
    sqlsrv.avail_physical_memory: USE_DEFAULT
    sqlsrv.avail_cpu_num: USE_DEFAULT
            
  • Execute
    srvbuildres -r adaptive_server.rs
  • Change the 'sa' database user password
    [sybase]$ isql -Usa
    Password:
    1> sp_password null, <sa_password>
    2> go
                
  • Execute
    [sybase]$ isql -Usa
    Password: <sa-password>
    1> disk init name='masterdisk', physname='/var/lib/sybase/masterdata.dat', size='32m'
    2> go
    1> disk init name='logdisk', physname='/var/lib/sybase/logdata.dat', size='32m'
    2> go
                
  • Create master and log devices
    [sybase]$ isql -Usa
    Password: <sa-password>
    1> disk init name='masterdisk', physname='/var/lib/sybase/masterdata.dat', size='32m'
    2> go
    1> disk init name='logdisk', physname='/var/lib/sybase/logdata.dat', size='32m'
    2> go
    
  • Create dbsyb database
    1> create database dbsyb on masterdisk='32m' log on logdisk='32m'
    2> go
    CREATE DATABASE: allocating 8192 logical pages (32.0 MB) on disk 'jbpmdata'.
    CREATE DATABASE: allocating 8192 logical pages (32.0 MB) on disk 'jbpmlog'.
    Database 'jbpm3' is now online.
    
  • Set database options * Truncate transactions log on checkpoint (JBPM-1829) * Abort transaction if the log is full
    1> sp_dboption dbsyb, "trunc log on chkpt", true
    2> go
    Database option 'trunc log on chkpt' turned ON for database 'jbpm3'.Running CHECKPOINT on database 'jbpm3' for option 'trunc log on chkpt' to take effect.
    (return status = 0)
    1> sp_dboption dbsyb, "abort tran on log full", true
    2> go
    Database option 'abort tran on log full' turned ON for database 'jbpm3'.
    Running CHECKPOINT on database 'jbpm3' for option 'abort tran on log full' to take effect.
    (return status = 0)
    
  • Add Sybase user appsyb with password appsyb
    
    1> sp_addlogin appsyb, appsyb, dbsyb
    2> go
    Password correctly set.
    Account unlocked.
    New login created.
    (return status = 0)
        
  • Change database owner
    1> use dbsyb
    2> go
    1> sp_changedbowner appsyb
    2> go
    Database owner changed.
    (return status = 0)
    
  • Start/stop database
    startserver -f $SYBASE/$SYBASE_ASE/install/RUN_SYBASE
        
  • Create start/stop script
    [ -z "$SYBASE_HOME" ] && SYBASE_HOME=`echo ~sybase`
    . $SYBASE_HOME/SYBASE.sh
    
    # Determine server name
    [ -z "$SYBASE_SERVER" ] && SYBASE_SERVER="SYBASE"
    
    # Find the name of the script
    BASENAME=`basename $0`
    
    # For SELinux we need to use 'runuser' not 'su'
    if [ -x /sbin/runuser ]
    then
    	SU=runuser
    else
    	SU=su
    fi
    
    script_result=0
    
    start() {
    	SYBASE_START=$"Starting ${BASENAME} service: "
    	echo -n "$SYBASE_START"
    	$SU -l sybase -c "startserver -f $SYBASE/$SYBASE_ASE/install/RUN_$SYBASE
    _SERVER" > /dev/null
    	ret=$?
    	if [ $ret -eq 0 ]
    	then
    		success "$SYBASE_START"
    	else
    		failure "$SYBASE_START"
    		script_result=1
    	fi
    	echo
    }
    
    stop() {
    	echo -n $"Stopping ${BASENAME} service: "
    	$SU -l sybase -c "isql -S $SYBASE_SERVER -U sa < ~/stop.in" > /dev/null
    	ret=$?
    	if [ $ret -eq 0 ]
    	then
    		echo_success
    	else
    		echo_failure
    		script_result=1
    	fi
    	echo
    }
    
    case "$1" in
    
    	start)
    		start
    		;;
    	stop)
    		stop
    		;;
    	status)
    		status dataserver
    		script_result=$?
    		;;
    	restart)
    		stop
    		start
    		;;
    	*)
    		echo $"Usage: $0 {start|stop|status|restart}"
    		script_result=1
    
    esac
    
    exit $script_result