Sybase Adaptive Server Anywhere
This section describes how to prepare and define a Sybase Adaptive Server Anywhere data
source in order to connect to it using the Adaptive Server Anywhere ODBC driver.
Adaptive Server Anywhere includes two database servers–a
personal database server and a network database server. For information
about using Sybase Adaptive Server Anywhere, see the Adaptive Server Anywhere documentation.
Supported versions and platforms for Adaptive Server Anywhere
Versions
The Adaptive Server Anywhere ODBC driver supports connection to local and remote
databases created with the following:
- PowerBuilder running on your
computer - Adaptive Server Anywhere Version 6.x
- SQL Anywhere Version 5.x
Platforms
The Adaptive Server Anywhere ODBC driver is available on the following operating
system platforms:
- Windows
NT - Windows 95/98
For more information about supported drivers
for your product, see “Supported Database Interfaces” in online
Help.
Basic software components for Adaptive Server Anywhere
The following diagrams show the basic software components
you need to connect to an Adaptive Server Anywhere data source in PowerBuilder.
Accessing Adaptive Server Anywhere
Preparing to use the Adaptive Server Anywhere datasource
Before you define and connect to an Adaptive Server Anywhere data source
in PowerBuilder, follow these steps to prepare the data source.
To prepare an Adaptive Server Anywhere data source:
-
Make sure the database file for the Adaptive Server Anywhere data
source already exists. You can create a new database by:-
- Launching the Create ASA Database utility. This
utility can be accessed from the Utilities folder for the ODBC interface
in the Database profile or Database painter when PowerBuilder is running
on your computer.
This method creates a local Adaptive Server Anywhere database on your computer,
and also creates the data source definition and database profile
for this connection. (For instructions, see the PowerBuilder
User’s Guide
.) - Creating the database some other way, such as with PowerBuilder running
on another user’s computer or by using Adaptive Server Anywhere outside PowerBuilder.
(For instructions, see the Adaptive Server Anywhere documentation.)
- Launching the Create ASA Database utility. This
-
-
Make sure you have the LOG file associated with
the Adaptive Server Anywhere database so you can fully recover the database if
it becomes corrupted.If the LOG file for the Adaptive Server Anywhere database does not exist, the Adaptive Server Anywhere database
engine will create it. However, if you are copying or moving a database
from another computer or directory, you should copy or move the
LOG file with it.
Defining the Adaptive Server Anywhere datasource
When you create a local Adaptive Server Anywhere database, PowerBuilder automatically
creates the data source definition and database profile for you.
Therefore, you need only use the following procedure to define
an Adaptive Server Anywhere data source when you want to access an Adaptive Server Anywhere database
not created using PowerBuilder on your computer.
To define an Adaptive Server Anywhere data source for the Adaptive Server Anywhere driver:
-
Launch the ODBC Data Source Administrator
utility. From the User DSN tab, click the Add button.The Create New Data Source dialog box displays.
-
Select the Adaptive Server Anywhere driver and click Finish.
The ODBC Configuration for Adaptive Server Anywhere dialog box displays:
-
You must supply the following values:
- Data source name on the ODBC tab
- User ID and password on the Login tab
- Database file on the Database tab
Use the Help button to get information about boxes in the
dialog box.Using the Browse button When you use the Browse button to supply the Database File
name (for example, SALES.DB), this name also displays without the
extension in both the Data Source Name and Database Name boxes.
This may change values that you previously supplied in these boxes.If you want to specify a different name for the data source
or database, you can edit one or both of these boxes after
using
the Browse button. -
(Optional) To select an ODBC translator to translate
your data from one character set to another, click the Select button
on the ODBC tab. - Click OK to save the data source definition.
Specifying a Start Line value
When the Adaptive Server Anywhere ODBC driver cannot find a running personal
or network database server using the PATH variable and Database Name
setting, it uses the commands specified in the Start Line field
to start the personal or network database servers.
Specify one of the following commands in the Start Line field
on the Database tab.
Specify this command | To |
---|---|
dbeng6.exe | Start the personal database server and the database specified in the Database File box |
dbsrv6.exe | Start the network database server and the database specified in the Database File box |
For information on completing the ODBC Configuration For Adaptive Server Anywhere dialog
box, see the Adaptive Server Anywhere documentation.
Support for Transact-SQL special timestamp columns
When you work with an Adaptive Server Anywhere table in the DataWindow or
Data Pipeline painter, the default behavior is to treat any column
named timestamp
as an Adaptive Server Anywhere Transact-SQL
special timestamp column.
Creating special timestamp columns
You can create a Transact-SQL special timestamp column in
an Adaptive Server Anywhere table.
To create a Transact-SQL special timestamp column
in an Adaptive Server Anywhere table in PowerBuilder:
-
Give the name timestamp
to
any column having a timestamp data type that you want treated as
a Transact-SQL special timestamp column. Do this in one of the following
ways:- In the DataWindow or
Data Pipeline painter Select timestamp
as the column name.
(For instructions, see the PowerBuilder User’s Guide
.) - In a SQL CREATE TABLE statement Follow the “CREATE TABLE example”.
- In the DataWindow or
-
Specify timestamp
as the
default value for the column. Do this in one of the following ways:- In the DataWindow or
Data Pipeline painter Select timestamp
as the default value
for the column. (For instructions, see the PowerBuilder
User’s Guide
.) - In a SQL CREATE TABLE statement Follow the “CREATE TABLE example”.
- In the DataWindow or
-
If you are working with the table in the Data
Pipeline painter, select the initial value exclude
for
the special timestamp column from the dropdown listbox in the Initial
Value column of the workspace.You must select exclude
as the initial
value to exclude the special timestamp column from INSERT or UPDATE
statements.For instructions, see the PowerBuilder
User’s Guide
.
CREATE TABLE example
CREATE TABLE example The following CREATE TABLE statement defines an Adaptive Server Anywhere table
named timesheet
containing three columns: employee_ID
(integer data type), hours (decimal data type), and timestamp (timestamp
data type and timestamp default value):
1 |
CREATE TABLE timesheet ( |
1 |
employee_ID INTEGER, |
1 |
hours DECIMAL, |
1 |
<i>timestamp TIMESTAMP default timestamp</i> ) |
Not using special timestamp columns
If you want to change the default behavior, you can specify
that PowerBuilder not
treat Adaptive Server Anywhere columns
named timestamp
as Transact-SQL special timestamp
columns.
To specify that PowerBuilder not
treat
columns named timestamp
as a Transact-SQL special
timestamp column:
-
Edit the Sybase Adaptive Server Anywhere section of the
PBODBn
0 initialization file to change the value
of SQLSrvrTSName from1'Yes'
to1'No'
.See Appendix A, “Adding
Functions to the PBODB70 Initialization File”.
What to do next
For instructions on connecting to the ODBC
data source, see “Connecting to a database”.