<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Connecting to Oracle using JavaScript</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
var conObj = new ActiveXObject('ADODB.Connection');
var connectionString = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.30.1.10)(PORT=1521)))(CONNECT_DATA=(SID=orcl)(SERVER=DEDICATED)));User Id=ZLHIS;Password=09BBB1;"
conObj.Open(connectionString);
var rs = new ActiveXObject("ADODB.Recordset");
sql = "SELECT To_Char(Sysdate,'yyyy-MM-dd hh24:mi:ss') As DateTime FROM DUAL"
rs.Open(sql, conObj);
alert("OracleDB Sysdate:"+rs(0));
rs.close;
conObj.close;
//-->
</script>
</body>
</html>
|