in , , , , , ,

Mad lad explains how to connect to an SQL database via Javascript

Mad lad explains how to connect to an SQL database via Javascript | javascript-memes, php-memes, java-memes, server-memes, data-memes, password-memes, security-memes, sql-memes, sql server-memes, database-memes, string-memes, object-memes, cli-memes, rds-memes, ide-memes, language-memes | ProgrammerHumor.io
javascript-memes, php-memes, java-memes, server-memes, data-memes, password-memes, security-memes, sql-memes, sql server-memes, database-memes, string-memes, object-memes, cli-memes, rds-memes, ide-memes, language-memes | ProgrammerHumor.io

Content

You shouldn’t use client javascript to access databases for several reasons (bad practice, security issues, etc) but if you really want to do this, here is an example: 748 var connection new Activexobject ("ADODB .Connection") ; var connectionstring "Data Source server; Initial Catalogcatalog ;User IDuser; Password connection. Open (connectionstring); new ActiveXObject ("ADODB. Recordset"); rs. Open ("SELECT FROM table", connection); rs.MoveFirst while(!rs.eof) document.writers.fields (1)); rs.movenext; rs. close; connection. close; A better way to connect to a sql server would be to use some server side language like PHP, Java, NET, among others. Client javascript should be used only for the interfaces. And there are rumors of an ancient legend about the existence of server javascript, but this is another story. 😉 Share Edit Follow Flag edited Jun 24 ’09 at 13:27 answered May 13 09 at 12:29 Fabio Vinicius Binder 12.5k 4 30 32