Introduction to Sybase, Part 1: Setting Up the Server
There is a basic client that comes with the Sybase SQL Server. This program is called isql. It is an interactive SQL program that allows you to enter SQL commands to the server and see the results. At the command line, type:
isql -Usa -Slinux_dev
The -U option tells the isql program which user name to use; sa is the system administrator account. It is similar to root on Linux. It has all rights in the server. The -S option specifies to which server to connect. In our case, the server name is linux_dev. The isql program will ask you for a password. Right after an installation, the sa user does not have a password, so just press enter. You can now enter SQL commands that will run on your SQL server.
The first command to run is a stored procedure that lets you change the password of a user. At the 1> prompt, type
sp_password is the name of the stored procedure. The sa user has no password, so we pass null as the first parameter. This parameter should be the password of the current user. The second parameter is the new password; put this password in quotes.
At the 2> prompt, type:
go tells the isql program to execute the command. If you make a mistake while typing a command before typing go, you can type reset to erase the command and try again.
All of the configuration information for the SQL server is stored in tables in the master database. Type the following:
1> select name from sysdatabases 2> go
This is an SQL command that queries the sysdatabases table. It will list the names of all the databases in your server. Almost all of the configuration information for the SQL server is stored in database tables. The documentation will give you more information on these tables.
To quit the isql program, type quit at the 1> prompt.
The SQL server comes with a script that will install an example database on your server. To install this database, type the following command at the $ prompt:
sql -Usa -i ~sybase/scripts/installpubs2 \ -Slinux_dev
Type your new password when prompted. The script will create a database called pubs2, then create tables with data in them. You can now type queries like the following:
isql -Usa -Slinux_dev Password: 1> use pubs2 2> go 1> select * from authors 2> go au_id au_lname ... ----------- ------------------- ... 172-32-1176 White ... 213-46-8915 Green ... ... 1> quit
Before you shut down your Linux system, you should shut down your Sybase servers. Do this using the isql program. Log in as the sa user to shut down the server. Once you are in isql, type shutdown SYB_BACKUP to shut down the backup server. SYB_BACKUP is the default name for a backup server. Then type shutdown to shut down the SQL server; this will remove both servers from memory. Now you can shut down your Linux system. If you don't shut down the servers properly, you could corrupt data. I recommend writing a script to perform this task automatically.
To start up the servers, you need to be logged in as the user sybase. Change to the install directory and type:
./startserver -f ./RUN_linux_dev
to start the SQL server and then
./startserver -f ./RUN_linux_dev_bsto start the backup server. A startup script named /etc/rc.d/init.d/sybase is installed on your system. You can link this script to the proper places in your rc.d directories so the server will automatically start and stop when you start and stop your Linux system.
You have installed the SQL server and the backup server and you know how to start and stop it. There is still more to learn about the server. At the end of this article is a list of resources that can help you learn about your new Sybase SQL server. I recommend reading the PostScript documentation that comes with the server. If you don't want to print the hundreds of pages of documentation, you can use ghostscript to view them. For an easier way to view the documentation, go to http://sybooks.sybase.com/dynaweb and select Sybase Version 11.0.x Products. You can read all the documentation via Sybase's web site.
Next month's installment will be about writing database clients and installing the Sybase extension for Perl (sybperl) that will enable writing database clients in Perl.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Sony Settles in Linux Battle
- Libarchive Security Flaw Discovered
- Profiles and RC Files
- Maru OS Brings Debian to Your Phone
- Snappy Moves to New Platforms
- The Giant Zero, Part 0.x
- Understanding Ceph and Its Place in the Market
- Git 2.9 Released
- Astronomy for KDE
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide