다음을 통해 공유


getConnection Method (java.lang.String, java.lang.String)

Tries to establish a connection with the data source that this SQLServerDataSource object represents by using the given user name and password.

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)

매개 변수

username

A String that contains the user name.

password

A String that contains the password.

반환 값

A SQLServerConnection object.

예외

java.sql.SQLException

주의

This getConnection method is specified by the getConnection method in the javax.sql.DataSource interface.

Calling the getConnection method with a non-null user name or password will replace the user name and password properties that are set on the SQLServerDataSource class when initializing the SQLServerConnection object. For example, if the caller has called setUser and setPassword on the data source, and then calls getConnection and supplies a non-null user name or a non-null password, the user name and password set by setUser and setPassword will be replaced by the user name and password passed into getConnection.

참고

The user name and password that are set inside the URL by using a call to the setURL method will not be changed in this case.

참고

참조

SQLServerDataSource Class

개념

getConnection Method (SQLServerDataSource)
SQLServerDataSource Methods
SQLServerDataSource Members