- Version: Sybase Adaptive Server, 12.5.2
- Server Host Name: rdb.cs.sunysb.edu
- Server Host Port Number: 5000
- MS Windows Path to Tools: C:\Program Files\Sybase
To access Sybase running on RDB
You will be given a database login and password. Every account which
is handed out has an empty database.
There are four ways you can access your database
Java Isql applet
The Java Isql applet can be used to interact with the database server from
home. It is located at
http://www.translab.cs.sunysb.edu/gateway.
You do
not need to copy the applet or the html file to your directory.
Just fill in the form with the necessary information.
Unless you are told differently, your database userid and database name
are always the same.
ISQL
-
Click on the Command Prompt icon
-
At the Prompt type:
cd c:\Program Files\sybase\OCS-12_5\bin
-
At the Prompt type:
isql -U<username> -Srdb {-i <filename> }
Where the username is the database name you
you were assigned. The -Srdb is the name of the
server (in this case, rdb). If you want to execute
a file, consisting of Sybase SQL statements, then use the
-i option, followed by the full pathname and file
you wish to execute. Upon execution, you will be prompted for your password.
-
If you log in correctly you will see a 1>
-
At this point you can start to execute commands like:
create table (a int)
-
After each command hit return.
-
If you would like to execute a command on the previous line(s) type:
go on the next line.
-
To exit isql type quit
JISQL
This is the recommended way to connect to a database.
-
Go to Start/Programs/Database/Sybase/jisql
-
Enter your Sybase username and password
-
Enter rdb for Hostname and
5000 for Portnumber
-
If you are trying to connect to the sybase server from outside of
the Graduate lab then you need to enter
PROXY=http://www.translab.cs.sunysb.edu/proxy/servlet/TDSTunnelServlet
in the Properties field.
-
Press the Connect button.
You should now be connected to your database.
-
You can type SQL commands on the top half of the window (Input Window).
After writing the command please remember that unlike
isql hitting return will not
execute the command. You have to press Go
-
Important: If you just close the window, your connection will
remain active. If there are too many connections the server will crash.
Please disconnect before closing the window. Click on
Connection/Close Connection.
-
For instructions for setting up JISQL from
outside of the Graduate lab, click here
Note: If you are using this tool from Solaris, the following shell script
is a modified version of the one that is distributed
by Sybase and should be used instead.
Sybase Central Java Edition
This a more advanced application for connecting to a Sybase Server.
-
Go to Start/Program/Database/Sybase/Sybase Central Java Edition
-
Enter your Sybase Username and password
-
Select rdb from the list of servers
-
Select Ok
-
If you entered the information correctly you should see a line for
RDB with your username in parentheses. By double
clicking on the RDB item and then the databases
item you can scroll through the list of databases on the server to find
yours. This list is long so it may take some effort to find your database.
Changing your password
You can change your password at any time with the system procedure
sp_password. The syntax is:
sp_password old_passwd, new_passwd
where old_passwd is the old password, and new_passwd is your new
password.
Use the following rules when creating a new password:
-
It must be at least 6 bytes long.
-
It can be any printable letters, numbers, or symbols.
-
The maximum size for a password is 30 bytes. If your password exceeds 30
bytes, Adaptive Server uses the first 30 characters, and then informs you
that it is ignoring the rest.
When you specify a password, enclose it in quotation marks if:
-
It includes characters other than A-Z, a-z, 0-9, _, #, valid single-byte
or multibyte alphabetic characters, or accented alphabetic characters
-
It begins with a number 0-9
The following example shows how to change the password
terrible2 to 3blindmice
sp_password terrible2, "3blindmice"
A return status of 0 means that the password was changed. For more information
about sp_password, see the Adaptive Server Reference Manual.
Handling your logs
Adaptive Server, as of version 12.5.2, has the ability to handle logs without
user intervention. Students who wish to handle their own logs, can do so using
the dump tran commands. The format of these commands
is shown below and are executed from a isql session.
Note: If you want to clean out your logs manually, you
should enter the commands in the sequence below, not in reverse order:
dump tran <databasename> with truncate_only
dump tran <databasename> with no_log
Your log will be truncated and you will be able to continue.
It is recommended that logs be flushed before running a long transaction.
You can see the status of the logs, with the following command from an isql session:
dbcc checktable(syslogs)
Important Coding Considerations for Sybase
If your application is written in anything but PHP, then you must make sure that when your
application (or thread) completes, that you disconnect from Sybase. Failure to do so leaves many
'hanging' processes on the server, and not only stops others from logging on to the server, but
could prevent you from logging in as well.
Therefore...please make sure you disconnect from sybase when done!
Please note:
Approximately 2-weeks before the end of the semester, a
script will execute every 10-minutes on the server, which will kill any sybase
process that is idle for over 5-minutes.
Sybase Documentation
For documentation regarding SQL, please go to the url:
http://sybooks.sybase.com/onlinebooks/group-as/asg1250e/sqlug
Address any concerns/questions to
rt (only from your campus email id ending in 'sunysb.edu' or 'stonybrook.edu')