java.sql.DriverManager.getConnection

A Java application using the JDBC API establishes a connection to a database by obtaining a Connection object. The standard way to obtain a Connection object is to call the method DriverManager.getConnection, which takes a String containing a database connection URL. A JDBC database connection URL (uniform resource locator) provides a way of identifying a database.

DriverManager.getConnection can take one argument besides a database connection URL, a Properties object. You can use the Properties object to set database connection URL attributes.

You can also supply strings representing user names and passwords. When they are supplied, Derby checks whether they are valid for the current system if user authentication is enabled. User names are passed to Derby as authorization identifiers, which are used to determine whether the user is authorized for access to the database and for determining the default schema. When the connection is established, if no user is supplied, Derby sets the default user to APP, which Derby uses to name the default schema. If a user is supplied, the default schema is the same as the user name.

Related concepts
Core JDBC java.sql Classes, Interfaces, and Methods
Related reference
java.sql.Driver
java.sql.Driver.getPropertyInfo
java.sql.Connection
java.sql.DatabaseMetaData
java.sql.Statement
java.sql.CallableStatement
java.sql.SQLException
java.sql.PreparedStatement
java.sql.ResultSet
java.sql.ResultSetMetaData
java.sql.SQLWarning
java.sql.SQLXML
Mapping of java.sql.Types to SQL types
java.sql.Blob and java.sql.Clob
java.sql.Connection
java.sql.ResultSet
java.sql.Statement
java.sql.PreparedStatement
java.sql.CallableStatement
java.sql.DatabaseMetaData
java.sql.ResultSetMetaData
java.sql.BatchUpdateException
JDBC Package for Connected Device Configuration/Foundation Profile (JSR169)
JDBC 3.0-only features
JDBC 4.0-only features
JDBC escape syntax