Java Database Connectivity: Difference between revisions

Content deleted Content added
m linking
m Make code more readable
Line 116:
When a Java application needs a database connection, one of the <code>DriverManager.getConnection()</code> methods is used to create a JDBC connection. The URL used is dependent upon the particular database and JDBC driver. It will always begin with the "jdbc:" protocol, but the rest is up to the particular vendor.
 
<source lang="java5">
Connection conn = DriverManager.getConnection(
"jdbc:somejdbcvendor:other data needed by some jdbc vendor",
Line 125:
} finally {
//It's important to close the connection when you are done with it
try {
conn.close();
} catch (Throwable e) { /* Propagate the original exception
instead of this one that you want just logged */
logger.warn("Could not close JDBC Connection",e); }
}
}
</source>
Line 250 ⟶ 254:
}
</source>
 
 
==JDBC drivers==