Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Up to this point, you have interacted only directly with a database using SQL. You will now tackle the task of using Java for connecting to a database.
Documentation for SQLite's JDBC Class
Looking at the documentation for org.sqlite.JDBC
, you'll see that it declares a static member as follows:
static {
try {
DriverManager.registerDriver(new JDBC());
}
catch (SQLException e) {
e.printStackTrace();
}
}
Later, when JDBC is used for establishing a connection, the acceptsURL(String)
method is used for determining which of the registered drivers should be used with the supplied connection string. Following the call to isValidURL(String)
, you can see that as long as the connection string begins with "jdbc:sqlite:" (see PREFIX
), this SQLite implementation of java.sql.Driver
will be used.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up