Home > Uncategorized > Connect to a #MySQL database from #Javascript with MySqlJS.com

Connect to a #MySQL database from #Javascript with MySqlJS.com

mysqljsIf you’ve ever needed to develop something in a hurry, and you find yourself writing more middleware than business logic or the website itself, then this is going to be a real time-saver.

MySqlJS.com  cuts out the middle tier of a website by communicating directly from the Javascript to the MySql database, using a statement such as

MySql.Execute(
    "mysql.yourhost.com", 
    "username", 
    "password", 
    "database", 
    "select * from Users", 
    function (data) {
        console.log(data)
});


But then, I see that you’re screaming at me!, this isn’t secure, everyone can see my database password!, but the point of this code is, that it’s not for scenarios where the source code is accessible to the public. So, it’s fine for Phonegap / Cordova / WinJS apps where the end user can’t access the source code. Or perhaps, if it’s a password-protected private website where only trusted employees are going to access it. – Or, it’s just a quick mock up for a demo, or school project.

If you want to play with it, and need a test database to play with, then you can use this:

Host: sql8.freemysqlhosting.net
Database name: sql8110237
Database user: sql8110237
Database password: Gn1uMM2Adr

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: