Hitachi

Hitachi Advanced Database Application Development Guide


10.2.3 getConnection(String username, String password)

Organization of this subsection

(1) Function

This method connects to the HADB server.

The connection is performed according to the HADB server connection information specified in the DataSource object and the connection information specified in the arguments, and then a Connection object is returned.

Specification priorities apply to the HADB server connection information. For details about the priorities, see 7.3.3 Connection information priorities.

Note that you must have the CONNECT privilege to execute the getConnection method.

(2) Format

public synchronized Connection getConnection(String username, String password) throws SQLException

(3) Arguments

String username

Specifies the authorization identifier that is to be used to connect to the HADB server.

String password

Specifies a password for the authorization identifier that is to be used to connect to the HADB server.

If null is specified for username or password, the JDBC driver assumes that no authorization identifier or password, respectively, is specified. If a character string with a length of zero is specified for password, the JDBC driver also assumes that no password is specified.

(4) Return value

This method returns a Connection object.

(5) Exceptions

The JDBC driver throws an SQLException in the following cases: