User's Guide
PART 4. Database Administration and Advanced Use
CHAPTER 29. Server Classes for Remote Data Access
JDBC-based server classes are used when Adaptive Server Anywhere internally uses a Java virtual machine and jConnect 4.0 to connect to the remote server. The JDBC-based server classes are:
asajdbc Adaptive Server Anywhere (version 6 and later)
asejdbc Adaptive Server Enterprise and SQL Server (version 10 and later).
When you access remote servers defined with JDBC-based classes, consider the following:
Your local database must be enabled for Java. Do not use the -j option on dbinit if you plan to use a JDBC-based server class.
The Java virtual machine needs more than the default amount of memory to load and run jConnect. Set these memory options to at least the following values:
SET OPTION PUBLIC.JAVA_NAMESPACE_SIZE = 3000000 SET OPTION PUBLIC.JAVA_HEAP_SIZE = 1000000
Since jConnect 4.0 is automatically installed with Adaptive Server Anywhere, no additional drivers need to be installed.
For optimum performance, Sybase recommends an ODBC-based class (asaodbc or aseodbc).
Any remote server that you access using the asejdbc or asajdbc server class must be setup to handle a jConnect 4.x based client. The jConnect setup scripts are sql_anywhere.sql for Adaptive Server Anywhere or sql_server.sql for Adaptive Server Enterprise. Run these against any remote server you will be using.
A server with server class asajdbc is:
Adaptive Server Anywhere (version 6 and later)
No special requirements exist for the configuration of an Adaptive Server Anywhere data source.
The USING parameter in the CREATE SERVER statement takes the form hostname:portnumber [/databasename], where:
hostname is the machine that the remote server is running on
portnumber is the TCP/IP port number that the remote server is listening on. The default port number that an Adaptive Server Anywhere listens on is 2638.
databasename is the Adaptive Server Anywhere database that the connection will use.
For example, to configure an Adaptive Server Anywhere named testasa that is located on the machine ????? and listening on port number 2638, use:
CREATE SERVER testasa CLASS 'asajdbc' USING 'apple:2638'
You must perform a separate CREATE SERVER for each Adaptive Server Anywhere database that you intend to access. For example, if an Adaptive Server Anywhere server named testasa is running on the machine 'banana' and owns 3 databases (db1, db2, db3), you would configure the local Adaptive Server Anywhere similar to this:
CREATE SERVER testasadb1 CLASS 'asajdbc' USING 'banana:2638/db1' CREATE SERVER testasadb2 CLASS 'asajdbc' USING 'banana:2638/db2' CREATE SERVER testasadb2 CLASS 'asajdbc' USING 'banana:2638/db3'
If you do not specify a /databasename value, the remote connection will use the remote Adaptive Server Anywhere default database.
A server with server class asejdbc is:
Adaptive Server Enterprise
SQL Server (version 10 and later)
No special requirements exist for the configuration of an Adaptive Server Enterprise data source.
When you issue a CREATE TABLE statement, Adaptive Server Anywhere automatically converts the data types to the corresponding Adaptive Server Enterprise data types. Table 2-1 describes the Adaptive Server Anywhere to Adaptive Server Enterprise data type conversions.
Adaptive Server Anywhere Data type |
ASE Default Data type |
---|---|
bit |
bit |
tinyint |
tinyint |
smallint |
smallint |
int |
int |
integer |
integer |
decimal [defaults p=30, s=6] |
numeric(30,6) |
decimal(128,128) |
not supported |
numeric [defaults p=30 s=6] |
numeric(30,6) |
numeric(128,128) |
not supported |
float |
real |
real |
real |
double |
float |
smallmoney |
numeric(10,4) |
money |
numeric(19,4) |
date |
datetime |
time |
datetime |
timestamp |
datetime |
smalldatetime |
datetime |
datetime |
datetime |
char(n) |
varchar(n) |
character(n) |
varchar(n) |
varchar(n) |
varchar(n) |
character varying(n) |
varchar(n) |
long varchar |
text |
text |
text |
binary(n) |
binary(n) |
long binary |
image |
image |
image |
bigint |
numeric(20,0) |