<%
'-------------------------------------oracle的数据库链接方法-----------------
set conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=MSDAORA.1;User ID=test;Password=456;Data Source=sms;Persist Security Info=False;"
var conn=Server.CreateObject("ADODB.Connection");//<==>rs=new ActiveXObject("ADODB.Connection")
var rs=Server.CreateObject("ADODB.Recordset");//rs=new ActiveXObject("ADODB.Recordset");<==>rs=Server.CreateObject("ADODB.Recordset");
conn.CursorLocation=3;
rs.CursorLocation=3;
conn.Open(Application("DBConn_ConnectionString"));
cnOracle.Open "Provider=OraOLEDB.Oracle.1;Persist Security
Info=True;User ID=username;Password=pwd;Data Source=servername;"
ODBC连接:
cnOracle.Open "Driver={Microsoft ODBC for oracle};Server=servername;Uid=username;Pwd=pwd;"
'sub connoracle(Database)
Database = "fzdc"
'On Error Resume Next
'连结资料库
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
'Set OraDatabase = OraSession.DbOpenDatabase(Request("Database"),Request("Name")&"/"&Request("Password"),0)
Set OraDatabase = OraSession.DbOpenDatabase(Database,"store/fz123",0)
If Err.Number > 0 Then
'判断是否发生错误
Response.Write "<H4>ASP的错误控制</H4>"
Response.Write "ASP 的错误来源:" & Err.Source & "<BR>"
Response.Write "ASP 的的错误代码:" & Err.Number & "<BR>"
Response.Write "ASP 的的错误说明:" & Err.Description & "<BR>"
Err.Clear
Response.Write "<H4>Oracle OLE 的错误控制</H4>"
Response.write "Oracle OLE的错误代码:" & OraSession.LastServerErr &"<BR>"
Response.write "Oracle OLE的错误说明:" & OraSession.LastServerErrText &"<BR>"
call closeconn
response.end
else
Response.write "<center><H3>资料库成功连结</center>"
set oradynaset=oradatabase.dbcreatedynaset(sqlstr,0)
End If
'end sub
'关闭资料库
'sub closeconn
OraDatabase.Close
'Free Session物件
Set OraSession = nothing
'end sub
%>