<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Connecting to Oracle using JavaScript</title>
<h1> Test orcl </h1>
</head>
<body>
<script language="JavaScript" type="text/javascript">
var conObj = new ActiveXObject('ADODB.Connection');
alert("new1");
var connectionString = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.168)(PORT=1521)))(CONNECT_DATA=(SID=orcl)(SERVER=DEDICATED)));User Id=michael;Password=0.0;"
try{
conObj.Open(connectionString);
var rs = new ActiveXObject("ADODB.Recordset");
sql = "SELECT SYSDATE FROM DUAL"
sq = "select fname from myemp123 where id = 2"
rs.Open(sq, conObj);
}catch(e)
{
alert(e.message);
}
alert("Á¬½Ó³É¹¦");
alert(rs(0));
rs.close;
conObj.close;
//-->
</script>
</body>
</html>
JavaScript下远程连Oracle数据库
最新推荐文章于 2022-04-22 18:34:54 发布