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: Connection string 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

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

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

ApplicationName, Application Name

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

No

Empty.

BufferCacheSize

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

No

20

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

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 includes 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

Database, Initial Catalog

The database to which you want to connect.

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.

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.

DSURL, Directory Service URL

The URL to the LDAP server.

No

Empty.

DTCProtocol (Windows only)

Allows the driver to use either an XA protocol or OleNative protocol when using distributed transactions. See “Using Distributed Transactions”, in Chapter 4, “ASE Advanced Features.”

No

XA

EnableServerPacketSize

Allows ASE server versions 15.0 or later to choose the optimal packetsize.

No

1

EncryptPassword, EncryptPwd, Encrypt Password

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

No

0

Encryption

The designated encryption. Possible values: ssl, none.

No

Empty.

FetchArraySize

Specifies the number of rows the driver retrieves when fetching results from the server.

No

25

HASession

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

No

0

IgnoreErrorsIfRS Pending

Specifies whether the driver is to continue processing or stop if error messages are present. When set to 1, the driver will ignore errors & continue processing the results if more results are available from the server. When set to 0, the driver will stop processing the results if an error is encountered even if there are results pending.

No

0

Language

The Language in which ASE returns error messages.

No

Empty – ASE uses English by default.

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

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

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

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

PacketSize, Packet Size

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

No

512

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

pooling

To disable connection pooling set to false.

No

true

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

RestrictMaximum PacketSize

If the you have memory constraints when EnableServerPacketSize is set to 1, then set this property to an int value in multiples of 512 to a maximum of 65536.

No

0

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.

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.

TextSize

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

No

Empty. ASE default is 32K.

TightlyCoupled Transaction (Windows only)

When using distributed transactions, if you are using two DSNs which connect to the same ASE server, set this to 1. See “Using Distributed Transactions”, in Chapter 4, “ASE Advanced Features.”

No

0

TrustedFile

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

No

Empty

UseCursor, Use Cursor

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

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';"