How to connect to the SQL Server database from a web application with JavaScript?

How to connect to the SQL Server database from a web application with JavaScript?

  

I want to be able to retrieve data from the native SQL Server database in the web application.

I can see that it works by rotating simple alerts using the JavaScript field on the "Web Screen" main screen. However, the result does not return when I try the connection question I created using "ActiveXObject".

"Internet Explorer" supports the use of "AvtiveXObject". I was also able to confirm that the query works in "Internet Explorer" by using "notepad ++", even if the user has permissions. However, I could not run this query below with "outsystems".

I would like your support on a solution or a different method.

Thanks in advance.



The JavaScript query I want to use:


<!DOCTYPE html>
<html>
    <head>
    <meta charset ="utf-8"/>
    </head>
     <body>
   
    <script>
    window.alert("before");
     </script>
     
<script>
var objConnection = new ActiveXObject("adodb.connection");
var strConn = "driver={sql server};server=******;database=****;uid=***;password=****";
objConnection.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
var strQuery = "SELECT CODE,DEFINITION_ FROM  ****.dbo.LG_001_CLCARD WHERE LOGICALREF=49";
rs.Open(strQuery,objConnection);
rs.MoveFirst();

while(!rs.eof) {
//Do your thing here
document.write(rs.fields(0) + "<br/>",rs.fields(1) + "<br/>");
window.alert(rs.fields(0));
rs.movenext;
}  
   
</script>


     <script>
    window.alert("after");
     </script>
   
    </body>
</html>


Hi Hasan,

This forum is meant to ask questions about and discuss the OutSystems Platform. It seems your question has nothing to do with the Platform, other then that you are trying to access an OutSystems database. I'll therefore close this topic.