Class.forName ("oracle.jdbc.OracleDriver")
DriverManager.getConnection (arguments)
The simplest form is
getConnection ("URL")
The URL is of the form:
jdbc:oracle:user/password@database
. For example,
getConnection ("jdbc:oracle:scott/tiger");
The
@database
phrase is optional, because there is a default database associated with the installation.The second form breaks URL into three string arguments. For example,
getConnection ("jdbc:oracle:","scott","tiger");
or, if you specify the database explicitly,
getConnection ("jdbc:oracle:@database","scott","tiger");
The third form relies on a Properties object. For example:
java.util.Properties info = new java.util.Properties();
info.addProperty ("user", "scott");
info.addProperty ("password"
,"tiger"
);
getConnection ("jdbc:oracle:",info);