Support for DSN-style Connection String Properties

The connect() method adds support for DSN-style connection properties.

connect()

Constructs a connection object representing a connection to a database.

The method accepts these keyword arguments:
  • user – the user login name that the connection uses to log in to a server.

  • password – the password that a connection uses when logging in to a server.

  • servername – defines the Adaptive Server name to which client programs connect. If you do not specify servername, the DSQUERY environment variable defines the Adaptive Server name.

  • dsn – the data source name. The data source name is a semicolon-separated string of name=value parts:

    • Name – a case-insensitive value that can be delimited by an equal sign (=) or semicolon (;). An attribute can have multiple synonyms. For example, server and servername refer to the same attribute.

    • Equals sign (=) – indicates the start of the value to be assigned to the Name. If there is no equals sign, the Name is assumed to be of boolean type with a value of true.

    • Value – a string that is terminated by a semicolon (;). Use a backslash (\) if a semicolon or another back slash is present in the value. Values can be of type boolean, integer, or string. Valid values for Boolean types are true, false, on, off, 1, and 0.

      Note: If a boolean name is present without a value, the Boolean type must be set to true.
    For example:
    sybpydb.connect(user='name', password='password string', 
                             dsn=’servername=Sybase;timeout=10’)