apache > db
Apache DB Project
 
Font size:      

java.sql.DriverManager.getConnection

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.


Previous Page
Next Page
Table of Contents
Index