Description  Connecting to the data source

Chapter 9: Setting Up the DirectConnect TDS Driver

Configuring the data source

Sybase assumes that you already have the latest MDAC version installed on your system. For issues regarding MDAC and to get the latest version, see the Microsoft Web site.

StepsTo configure a DirectConnect ODBC data source

  1. Start the ODBC Administrator by selecting the ODBC icon from the Windows control panel.

  2. Do one of the following:

  3. Specify values for the data source using the information in the following table.

    Table 9-1: Required data source configuration properties

    Property

    Description

    DataSourceName

    A string that identifies this DirectConnect data source.

    Description

    An optional long description of a data source name, for example, “My Accounting Database.”

    ServerName

    The name of the server containing the DirectConnect tables that you want to access.

    Network address

    The machine name (or IP address) and port number of the DirectConnect service to which this data source name will connect, for example, <host name>,<port number>

    Service name

    Name of the DirectConnect access service that is listening on the network address, to which this data source name will connect.

  4. Specify values for any optional properties that you require. The properties are listed in the following table.

    Table 9-2: Optional data source configuration properties

    Property

    Description

    ServerList

    The list of servers that appear in the logon dialog box. Use commas to separate the server names.

    DatabaseName

    The name of the database to which you want to connect by default. If you do not specify a value, the default is the default database defined for each user.

    DatabaseList

    The databases that appear in the logon dialog box. Use commas to separate the database names.

    DefaultLogonID

    The default logon ID used to connect to your database. This ID is case sensitive. A logon ID is required only if security is enabled for the database to which you are connecting. Your ODBC application can override this value, or you can override this value in the logon dialog box or in the connection string.

    InterfacesFile

    The path name of the interfaces file. The default is the Sybase sql.ini file.

    Initialization String

    A string of SQL Server commands that execute when the data source connection initializes. Use semicolons to separate multiple commands.

    ModifySQL Statement

    An instruction to the driver to convert a single- or two-part table name to a three-part format for create table SQL statements. Valid values are:

    • 0 instructs the driver to treat all SQL statements as being in passthrough transformation mode and to not modify them.

    • 1 instructs the driver to modify the SQL statements, and to convert table names to three-part format and change NULL and NOT NULL statements.

    Password Encryption

    A number that determines whether password encryption can be performed from the Open Client Library to the server. Valid values are:

    • 0 prevents encryption from being performed.

    • 1 allows encryption to be performed.

    Charset

    The name of a character set corresponding to a charsets subdirectory. The default is the setting on the DirectConnect server.

    WorkstationID

    The workstation ID used by the client.

    Language

    The national language corresponding to a locales subdirectory. The default is U.S. English.

    ApplicationName

    The name used by the DirectConnect server to identify your application.

    YieldProc

    A numeric value that determines whether you can work in other applications when the DirectConnect server is busy. Valid values are:

    • 0 (peek and dispatch) causes the driver to check the Microsoft Windows message queue and send any messages to the appropriate application.

    • 1 (no yielding; the default) prevents you from working in other applications.

    • 3 (dispatch through Windows Yield function) gives control to the Windows kernel, which checks the message queue and sends messages to the appropriate applications.

    Sybase recommends that you use value 1.

    OptimizePrepare

    A value that determines whether stored procedures are created on the Server for every call to SQLPrepare. Valid values are:

    • 0 causes stored procedures to be created for every call to SQLPrepare. This setting can decrease performance.

    • 1 causes the driver to create stored procedures only if the statement contains parameters. Otherwise, the statement is cached and executed directly at SQLExecute time. This is the initial default value.

    • 2 prevents the driver from creating stored procedures.

    ArraySize

    The number of rows the driver retrieves from the server for each fetch. This is not the number of rows given to the user. The default is 10 rows.

    SelectMethod

    A value that determines whether database cursors are used for select statements. Valid values are:

    • 0 allows database cursors to be used. This is the initial default. In some cases, performance degradation can occur when large numbers of sequential select statements execute because of the large amount of overhead associated with creating the cursors.

    • 1 allows select statements to execute directly without database cursors. The data source is limited to one active statement and one active connection.

    ReuseFailedCursor

    A value that determines whether the server attempts to reuse a cursor that contains an error. Valid values are:

    • 0 causes the server to deallocate a cursor that contains an error and force the application to start over.

    • 1 causes the server to attempt to reuse a cursor containing an error. This is the default value.

    PacketSize

    A number that determines the number of bytes per network packet transferred from the database server to the client. The correct setting of this attribute can improve performance. Valid values are:

    • 0 directs the driver to use the default packet size as specified in the DirectConnect server configuration. This is the initial default configuration.

    • -1 directs the driver to compute the maximum allowable packet size on the first connect to the data source and save the value in the odbc.ini file.

    • x (an integer from 1 to 10) directs the driver to set the packet size to x times 512 bytes. For example, a value of 6 sets the packet size at six times 512, or 3072 bytes.

    To use this connection attribute, you must configure the DirectConnect server for a maximum network packet size greater than or equal to the value of this property.

    The ODBC specification specifies a connect option sql_packet_size that offers this same functionality. To avoid conflicts with applications that can set both the connection string attribute and the ODBC connect option, both functions are defined as mutually exclusive.

    If PacketSize is specified, you receive the message “Driver Not Capable” when you attempt to call sql_packet_size. If you do not set PacketSize, the driver accepts application calls to sql_packet_size.

    Translate

    An instruction that displays the Select Translator dialog box, from which you can perform a data translation from one character set to another. Choose the INTERSOLV OEM ANSI translator to translate data from the IBM PC character set to the ANSI character set.

  5. Choose OK to write these values to the ODBC data source configuration.

    The values are now the default values when you connect to this data source.

  6. To change the values, do one of the following:





Copyright © 2005. Sybase Inc. All rights reserved. Connecting to the data source

View this book as PDF