1

I'm thinking about writing a Javascript based MySQL client. The client would work like MySQL Query Brwoser, and would connect to a remote MySQL db.

Are there any - client side - Javascript - MySQL communication libraries?

I've found this topic: How to connect to SQL Server database from JavaScript in the browser?

Are there any similar solutions (not using ActiveXObjects)?

Thanks, krisy

1
  • No; if you want to do it from a browser (as the question suggests). Commented Jan 17, 2012 at 15:44

1 Answer 1

2

Javascript (at least in a browser) does not provide socket support (hence the use of an ActiveX object in the example you cited). Nor does it have the low-level type conversions that would be required for implementing a client. So even if you were to work out the mysql protocol (see mysqlproxy as well as myqld and the standard client libs).

So unless you want to write your own browser, you'll need to think about some sort of bridge between javascript and mysql.

A further issue is that most people wouldn't want to give direct DML facilities at the client - so even if you're currently connecting across a VPN, then you need to spend a significant amount of time thinking about authentication and session management.

There's some discussion about database abstraction here and in other places.

If it were me I'd be thinking about AJAX/JSON from javascript to the bridge, bridge running somewhere close to the mysql DBMS and implemented in a language with native mysql support (e.g. Perl, PHP) which provides for session support over HTTP.

HTH

Sign up to request clarification or add additional context in comments.

4 Comments

Actually, I was thinking about using HTML5 Websockets ...does this make sense?
websocket != socket. Still going to need a protocol adapter.
Can the protocol adapter be written in JS?
It is possible to do with the mysql-live-client HOWEVER I'd strongly advise against for security reasons :) npmjs.com/package/mysql-live-client#principles-of-mysql-live

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.