AseConnection constructors

Description

Initializes an AseConnection object. The connection must then be opened before you can carry out any operations against the database.

Syntax 1

AseConnection( )

Syntax 2

AseConnection( string connectionString )

Parameters

connectionString: An ASE connection string. A connection string is a semicolon-separated list of keyword-value pairs.

Table 5-1: Connectionstring parameters

Property name

Description

Required

Default Value

UID, UserID, User ID, User

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

Yes

Empty

PWD, Password

A case-sensitive password to connect to the ASE server

No, if the user name does not require a password

Empty

Server, Data Source, DataSource, Address, Addr, Network Address, Server Name, Service Name

The name or the IP address of the ASE server�

Yes

Empty

Port, Server Port

The port number of ASE server

Yes, unless the port number is specified in the Datasource

Empty

Database, Initial Catalog

The database to which you want to connect

No

Empty

UseCursor, Use Cursor

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

No

0

ApplicationName, Application Name

The name to be used by ASE to identify the client application

No

Empty

PacketSize , Packet Size

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, none

No

Empty

TrustedFile

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

No

Empty

DSURL, Directory Service URL

The URL to the LDAP server

No

Empty

DSPrincipal, Directory Service Principal

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, Directory Service Password

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

LoginTimeOut, Connect Timeout, Connection Timeout

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

HASession

Specifies if High Availability is enabled. 0 indicates High Availability disabled, 1 High Availability enabled

No

0

SecondaryServer, Secondary Data Source, Secondary DataSource, Secondary Server, Secondary Address, Secondary Addr, Secondary Network Address, Secondary Server Name, Secondary Service Name

The name or the IP address of the ASE server acting as a failover server in an active-active or active-passive setup.�“Secondary Data Source” can be: SecondaryServer:SecondaryPort or SecondaryServer, SecondaryPort

Yes, if HASession is set to 1

Empty

SecondaryPort, Secondary Port, Secondary Server Port

The port number of the ASE server acting as a failover server in an active-active or active-passive setup.

Yes, if HASession is set to 1, unless the port number is specified in the Secondary DataSource

Empty

EncryptPassword, EncryptPwd, Encrypt Password

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

No

0

BufferPoolSize, Buffer Pool Size

Keeps the Input / Output buffers in pool. Increase for very large results to boost performance

No

20

NamedParameters

Set to false if you intend to use parameter markers instead of named parameters. Example with named parameters the SQL will look like SELECT * from titles where title_id = @title_id�The same SQL with parameter markers will look like SELECT * from titles where title_id = ?

No

true

pooling

To disable connection pooling set to false

No

true

max pool size

You can restrict the connection pool not to grow more than the specified max pool size. The provider will throw an AseException on AseConnection.Open() if this limit is reached

No

100

min pool size

You can force the provider to close connections to ASE so that total number of open connections hover around min pool size. The provider closes the connection on AseConnection.Close() if the number of connections in the pool are equal to min pool size

No

20

Ping Server

Set to false if you do not want the provider to verify that the connection is valid before it uses it from the connection pool

No

true

CumulativeRecordCount, Cumulative Record Count, CRC

By default the driver (use provider for ADO.NET) 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 (use provider for ADO.NET) to return just the last update count

No

1

ClientHostName

The name of client host passed in the login record to the server, for example: ClientHostName='MANGO'

No

Empty

ClientHostProc

The identity of client process on this host machine passed in the login record to the server, for example: ClientHostProc='MANGO-PROC'

No

Empty

TextSize

The maximum size of binary or text data in bytes that will be sent to or recieved from ASE, for example: TextSize=64000 sets this limit to 64K bytes

No

Empty. ASE default is 32K

AnsiNull

Strict ODBC compliance where you cannot use “= NULL”. Instead you have to use “IsNull”. Set to 1 if you want to change the default behavior.

No

0

NoteData Source, DataSource, Secondary Data Source, Secondary DataSource are special keywords. In addition to being the server name, they can also be formatted as

DataSource=servername,port

or

DataSource=servername:port

For example, DataSource=gamg:4100 sets the server name to "qamg" and the port to “4100.” In this case the Port keyword would not be needed in the connection string.

Example

The following statement initializes an AseConnection object for a connection to a database named “policies” running on an ASE database server named “HR-001.” The connection uses a user ID of “admin” with a password of “money”.

"Data Source='HR-001';
Port=5000; UID='admin';
PWD='money';
Database='policies';"