你先在odbc里建一个数据源名字是myoracle, 然后用下面的语句进行连接,
没问题的,我试过了。 uid 是你连接oracle的用户名,pwd是密码。
set conn=server.createobject("adodb.connection")
conn.connectionstring="dsn=myoracle;uid=system;pwd=manager"
conn.open
不过我建议你用oracle8i自带OO4Oserver来连接,
gloal.asa文件的内容是:
<OBJECT RUNAT=Server SCOPE=Application ID=OraSession PROGID="OracleInProcServer.XOraSession">
</OBJECT>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'Get an instance of the Connection Pooling object and create a pool of OraDatabase
'
OraSession.CreateDatabasePool 1,40,200,"", "songmk/songmk", 0
End Sub
</SCRIPT>
这是一个例子:
0040.asp
<html>
<head>
</head>
<body>
<form ACTION="0040.asp" METHOD="POST">
<%
SQL = Request("SQL")
%>
<p>SQL Select Query: <input SIZE="48" NAME="SQL" VALUE="<%=SQL%>"></p><p><input TYPE="SUBMIT"></p></form>
<%
If SQL<>"" Then
Set ODB = OraSession.GetDatabaseFromPool(10)
Set ORS = ODB.CreateDynaset(SQL,0)
'Set ORS = ODB.OraSQLStmt(SQL,0)
response.end
Set Columns= ORS.Fields
%>
<table BORDER="1">
<tr>
<% For i = 0 to Columns.Count - 1 %>
<td><b><% = Columns(i).Name %></b></td>
<% Next %>
</tr>
<% while NOT ORS.EOF %>
<tr>
<% For col = 0 to Columns.Count - 1 %>
<td><A href="0040.asp?SQL=select * from <%=columns(col)%>"><% = Columns(col) %></A></td>
<% Next %>
</tr>
<% ORS.MoveNext %>
<% WEnd %>
</table>
<%End If%>
</body>
</html>