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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Martin Batista](https://uploads.teamtreehouse.com/production/profile-photos/5996012/micro_20170707_202753_m3.jpg)
Martin Batista
4,606 PointsI'm getting syntax error and I can't find it. Please point me in the right direction
c.executeUpdate("INSERT INTO languages(id,name)VALUES(2,'Java')");
// Load class "org.sqlite.JDBC"
Class.forName("org.sqlite.JDBC");
// Establish connection to database named "treehouse.db"
try(Connection c = DriverManager.getConnection("jdbc:sqlite:treehouse.db")) {
c.executeUpdate("INSERT INTO languages(id,name)VALUES(2,'Java')");
} catch(SQLException ex) {
}
2 Answers
![Kourosh Raeen](https://uploads.teamtreehouse.com/production/profile-photos/3971082/micro_TreehouseProfilePic.jpg)
Kourosh Raeen
23,733 PointsYou need to create a Statement and call executeUpdate on that.
![Akhter Rasool](https://secure.gravatar.com/avatar/ccc0728819aa6e633233907556f9a75d?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Akhter Rasool
8,597 PointsAfter the first statement in the try block insert a ';' and then next line you must create a statement in the following manner:
Statement statement (equals) c.createStatement();
this creates a statement where this statement can hold a sql statement and execute that very query.
so the way you execute your sql query is like this:
statement(dot)executeUpdate("INSERT INTO languages(id,name)VALUES(2,'Java')");
![Martin Batista](https://uploads.teamtreehouse.com/production/profile-photos/5996012/micro_20170707_202753_m3.jpg)
Martin Batista
4,606 PointsI see my mistake now.
Thank you very much!
Martin Batista
4,606 PointsMartin Batista
4,606 PointsThank you very much!