First Guide to SQL Anywhere Studio
PART 2. Getting Results with SQL Anywhere Studio
CHAPTER 3. Running and Connecting to a Database Server
Once the database server is running, you can connect to it from an application. Here we connect to it from Interactive SQL.
Ensure that the sample database is loaded on a running database, as described in. Starting the database server.
Start Interactive SQL.
In Windows 95 and Windows NT, select Start->Programs->Sybase->Adaptive Server Anywhere 6.0->Interactive SQL.
In Windows 3.x and OS/2, select Interactive SQL from the Adaptive Server Anywhere 6.0 program group.
In UNIX operating systems, enter dbisql at the command line.
The Interactive SQL logon window is displayed. For Windows 95 and Windows NT it looks as follows. For other operating systems the appearance is slightly different.
Enter the user ID DBA and the password SQL. This is the default user ID and password for Adaptive Server Anywhere databases when they are created. The password does not appear when you type it. This prevents someone else from seeing your password. Click OK to connect to the sample database.
After connecting to the database, the Interactive SQL window appears.
The Interactive SQL window displays the database name, user ID, and server name for the connection on the title bar. The words Connected to database appear in the Statistics window along with a message displaying the collation sequence used by the database.
Once you are connected to the database, you can send commands to it. For example, type the following line in the Command window.
SELECT * FROM employee;
The asterisk (*) in the query displays all the columns of the table named employee. This table contains information about the employees of a fictitious merchandising company.
Click Execute or press F9. Information similar to the following will appear in the Data window.
emp_id |
manager_id |
emp_fname |
emp_lname |
---|---|---|---|
102 |
501 |
Fran |
Whitney |
105 |
501 |
Matthew |
Cobb |
129 |
902 |
Philip |
Chin |
148 |
1293 |
Julie |
Jordan |
160 |
501 |
Robert |
Breault |
Interactive SQL retrieves the information by sending a request to your database server. The server, in turn, looks up the information in the employee table and returns it to Interactive SQL.
Other applications connect to the database in much the same way. To make the connection, they must submit both a user ID and a password.