Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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!