Generalized app.js and extracted code into sql_driver.js.