Share via


IDriver.Connect(String, Properties) Method

Definition

Attempts to make a database connection to the given URL.

[Android.Runtime.Register("connect", "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;", "GetConnect_Ljava_lang_String_Ljava_util_Properties_Handler:Java.Sql.IDriverInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Sql.IConnection? Connect (string? url, Java.Util.Properties? info);
[<Android.Runtime.Register("connect", "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;", "GetConnect_Ljava_lang_String_Ljava_util_Properties_Handler:Java.Sql.IDriverInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Connect : string * Java.Util.Properties -> Java.Sql.IConnection

Parameters

url
String

the URL of the database to which to connect

info
Properties

a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included.

Returns

a Connection object that represents a connection to the URL

Attributes

Exceptions

if a database error occurs.

Remarks

Attempts to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn.

The driver should throw an SQLException if it is the right driver to connect to the given URL but has trouble connecting to the database.

The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. Normally at least "user" and "password" properties should be included in the Properties object.

Java documentation for java.sql.Driver.connect(java.lang.String, java.util.Properties).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to