JavaScript is a client-side language. For security reasons, client-side languages cannot have direct access to a database (this would imply passwords and other sensitive data to travel insecurely through the net). To pull information from a database (SQlite, MySQL, SQL, etc) you need to use a server-side language like PHP.
Once you have parsed that information from the database on the server, you can then send it to the client (your browser) and do all kinds of crazy stuff with JavaScript.
If you need more clarification on the difference between a client-side language and a server-side language, take a look at this good tutorial:
http://www.scriptingok.com/tutorial/Ser ... lient-sideLet me know if you have any other question.
REGARDS