Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Chapter 1 Introduction to ASE OLE
DB Provider [Table of Contents] Chapter 3 ASE Advanced
Features

User's Guide Adaptive Server Enterprise OLE DB Provider by Sybase

[-] Chapter 2 Connecting to a Database

Chapter 2

Connecting to a Database

This chapter describes how client applications connect to Sybase Adaptive Server Enterprise using the ASE OLE DB Provider.

Introduction to connections

Any client application that uses ASE must establish a connection to that server before any work can be done. The connection forms a channel through which all activity from the client application takes place. For example, your user ID determines permissions to carry out actions on the database--and the database server has your user ID because it is part of the request to establish a connection.

The ASE OLE DB Provider uses connection information included in the call from the client application, perhaps together with information held on disk in an initialization file, to locate and connect to an ASE server running the required database.

How connection parameters work

When an application connects to a database, it uses a set of connection parameters to define the connection. Connection parameters include information such as the server name, the database name, and a user ID. A keyword-value pair (of the form parameter=value) specifies each connection parameter. For example, you specify the user ID connection parameter as follows:

User ID=sa

Passing connection parameters as connection strings

Connection parameters are assembled into a connection string, in which a semicolon separates each connection parameter, as shown:

parameter1=value1;parameter2=value2;...

The connection string is then passed to the ASE OLE DB Provider.

Using connection parameters

Following is a list of connection parameters that can be supplied to the ASE OLE DB Provider.

Table 2-1: Connection parameters

Property names

Description

Required

Default value

User ID, UserID, UID

A case-sensitive user ID required to connect to the ASE server.

Yes

None

PWD, Password

A case-sensitive password to connect to the ASE server.

No, if the user name does not require a password

Empty

Data Source

The Data Source you want to connect in Server:Port format.

No, if server and port are specified

Empty

Server

The name or the IP address of the ASE server.

No, if data source is specified

Empty

Port

The port number of ASE server.

No, if data source is specified

Empty

Initial Catalog, Database

The database to which you want to connect.

No

Empty

UseCursor

Specifies whether cursors are to be used by the driver. 0 indicates do not use cursors, and 1 indicates use cursors.

No

0

ApplicationName

The name ASE uses to identify the client application.

No

Empty

PacketSize

The number of bytes per network packet transferred between ASE and the client.

No

512

CharSet

The designated character set. The specified character set must be installed on the ASE server.

No

Empty

Language

The language in which ASE returns error messages.

No

Empty - ASE uses English by default.

Encryption

The designated encryption. Possible values: ssl.

No

Empty

TrustedFile

If encryption is set to ssl, this property should be set to the path to the Trusted File.

No

Empty

DSURL

The URL to the LDAP server

No

Empty

DSPrincipal

The user name used to authenticate on the LDAP server, if the LDAP server does not allow anonymous access. The Principal can be specified in the DSURL as well.

No

Empty

DSPassword

The password used to authenticate on the LDAP server, if the LDAP server does not allow anonymous access. The password can be specified in the DSURL as well.

No

Empty

DynamicPrepare

When set to 1, the driver sends SQLPrepare calls to ASE to compile/prepare. This can boost performance if you reuse the same query repeatedly.

No

0

LoginTimeOut

Number of seconds to wait for a login attempt before returning to the application. If set to 0, the timeout is disabled and a connection attempt waits for an indefinite period of time.

No

10

QuotedIdentifier

Specifies if ASE treats character strings enclosed in double quotes as identifiers. 0 indicates do not enable quoted identifiers, 1 indicates enable quoted identifiers.

No

0

EncryptedPassword

Specifies if password encryption is enabled. 0 indicates password encryption is disabled, 1 indicates password encryption is enabled.

No

0

BufferPoolSize

Keeps the input / output buffers in pool. When large results will occur, increase this value to boost performance.

No

20

CRC

By default, the driver returns the total records updated when multiple update statements are executed in a stored procedure. This count will also include all updates happening as part of the triggers set on an update or an insert.

Set this property to 0 if you want the driver to return only the last update count.

No

1

ClientHostName

The name of the client host passed in the login record to the server.

No

Empty

ClientHostProc

The identity of the client process on this host machine passed in the login record to the server.

No

Empty

TextSize

The maximum size of binary or text data that will be sent over the wire.

No

Empty. ASE default is 32K.

AnsiNull

Strict compliance where you cannot use "= NULL." Instead, you must use "IsNull."

No

1

Connecting from ADO

Microsoft ActiveX Data Objects (ADO) is an object-oriented programming interface. In ADO, the Connection object represents a unique session with a data source. You can use the following Connection object features to initiate a connection:

Example

The following Visual Basic code uses the connection objects to initiate an OLE DB connection to ASE:

' Declare the connection object
Dim myConn as New ADODB.Connection
myConn.Provider = "ASEOLEDB"
myConn.ConnectionString ="Data Source=MANGO:5000; User ID=sa"
myConn.Open


Datatype mapping [Table of Contents] Chapter 3 ASE Advanced
Features