系统环境:
1、操作系统:Windows 2000
2、数据库: Oracle 8i R2 (8.1.6) for NT 企业版
3、安装路径:C:\ORACLE
访问方法:
1、连入SQL*Plus以system/manager用户登录,SQL> conn system/manager创建新的用户:如user1/pass1,赋予connect,resource权限。SQL> grant connect,resource to user1 identified by pass1;SQL> conn user1/pass1SQL> create table test(a date);Oracle数据库的实例名,本例:oradbOracle用户名,本例:user1Oracle主机字符串:oradbtnsnames.ora文件中ORADB = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.1.1.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = oradb) ) )2、在IIS默认WWW目录下创建test.asp,用notebook编辑,输入以下代码<%<br>set conn=server.createobject("adodb.connection")<br>dns="Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=user1;Password=pass1;Data Source=oradb"<br>conn.Open dns<br><br>SQL="insert into test(a) values(sysdate)"<br>set rs=conn.execute(SQL)<br><br>set rs=nothing<br>conn.close<br>set conn=nothing<br>%><br><br><%<br>set conn=server.createobject("adodb.connection")<br>dns="Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=user1;Password=pass1;Data Source=oradb"<br>conn.Open dns<br><br>SQL="select to_char(a,'hh24:mi:ss') from test"<br>set rs=conn.execute(SQL)<br><br>do while (not rs.eof)<br>%><br><table border=1><br><tr><td><%=rs.fields(0).value%></font></td><br></tr><br><%<br>rs.movenext<br>loop<br><br>rs.close<br>set rs=nothing<br>conn.close<br>set conn=nothing<br>%><br>3、打开一个浏览器窗口,输入以下地址来查看运行结果,可以通过不断的按F5键来刷新显示结果http://localhost/test.asp