Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Hibernate Basics Data Persistence & ORMs Using JDBC to Connect to a Database

Ricard Taujenis
Ricard Taujenis
4,383 Points

Connect to a database by loading the driver contained in "org.sqlite.JDBC" and replacing the null value of c with an est

not sure whats done wrong

// Load class "org.sqlite.JDBC"

// Establish connection to database named "treehouse.db"
try(connenction connection =DriveManager.getConnection("org.sqlite.JDBC:treehouse.db" ))
try(Connection c = null) {

} catch(SQLException ex) {


1 Answer

Chris Ramacciotti
Chris Ramacciotti
Treehouse Guest Teacher

Hi Ricard! It looks like there are a few problems with the code you posted above. First, you haven't loaded the "org.sqlite.JDBC" class under the comment you've included. Second, the first Connection variable you've declared in the try-with-resources block has a misspelled data type. Next, you've omitted the first "r" in DriverManager. And finally, the connection URL should begin with "jdbc:sqlite".

Since this is a code challenge, I won't give you the exact answer here. :) But, with this info and a review of the related video, you should be well on your way to the answer, if you haven't gotten it already. Cheers!