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 trialdolores fernandez
375 PointsDoes the database HAVE TO be placed in the root folder? sqlite:".__DIR__."/the_database.db
On the first step for creating the database.db, we are using DIR to place it in our root folder of our project, does it have to be there? Could we just do "sqlite:the_database.db" ? I have tried with the Exception, but it seems alright, so I can't tell if it has to be placed in the root folder or we can place it wherever we want.
2 Answers
Jonathan Grieve
Treehouse Moderator 91,253 PointsNormally you'd put the file in the connections folder which is why you don't specify a file path with the file name. It indicates that your database is in the same folder as your connection file not necessarily the root folder. :-)
Don Macarthur
28,430 PointsJust further to this question, does declaring the file path this way ensure that once your site is FTP'd up to the production server the database connection will still work?
Cheers Don :-)
dolores fernandez
375 Pointsdolores fernandez
375 PointsThank you! It sounds ridiculous but yesterday I spent many hours looking for that information and I ended up frustrated because I couldn't find that answer anywhere!