Connection.from_dsn
Description:
[ Version ( since = "6.0" ) ]
public Connection.from_dsn (DsnInfo dsn, string? auth_string, ConnectionOptions options) throws Error
This function creates a new connection, using a pre-defined data source (DSN), see define_dsn for more information about how to define a DSN.
If you don't want to define a DSN, it is possible to use Connection.from_string instead of this method.
The auth_string
can contain the authentication information for the server to accept the connection. It is a string containing
semi-colon seperated named value, usually like "USERNAME=...;PASSWORD=..." where the ... are replaced by actual values. Note that each name and
value must be encoded as per RFC 1738, see rfc1738_encode for more information.
If auth_string
is given, it wil be used, otherwise auth_string of DsnInfo
will be used.
The actual named parameters required depend on the provider being used, and that list is available as the <parameter>auth_params< /parameter> member of the ProviderInfo structure for each installed provider ( use get_provider_info to get it). Also one can use the "gda-sql-6.0 -L" command to list the possible named parameters.
This method may fail with a GDA_CONNECTION_ERROR domain error (see the ConnectionError error codes) or a gda_config_error domain error (see the ConfigError error codes).
The returned connection is not yet opened, you need to call open or open_async.
Parameters:
dsn |
data source name. |
auth_string |
authentication string, or null |
options |
options for the connection (see ConnectionOptions). |
Returns:
a new Connection or null if there was an error. |