asp连接数据库oracle
1、利用ODBC,性能不是很稳定。
2、利用ADO,有两个驱动,一个是microsoft提供的,一个是oracle提供的。各有优缺点。
3、利用oracle专门给asp的驱动,性能最稳定,速度最快。我一直用这个。
set Conn=server.CreateObject("adodb.connection")
'Conn.open "dsn=mmaximo;uid=user;pwd=pwd"
Conn.open "maximo","user","pwd"
'dns="Driver={Microsoft ODBC for Oracle};UID=user;PWD=pwd;server=10.128.64.7"
'Conn.open dns
'dns="Provider=MSDAORA.1;Password=pwd;User ID=user;Data Source=thpmis;Persist Security Info=True"
'dns="Provider=OraOLEDB.Oracle.1;Password=pwd;User ID=user;Data Source=thpmis;Persist Security Info=True"
'Conn.open dns
'set OraSession=Server.CreateObject("OracleInprocServer.XOraSession")
'set OraDatabase=OraSession.OpenDatabase("maximo","user/pwd",0)
'set ors=OraDatabase.CreateDynaset("select * from workorder",0)
'response.write "总共有" & ors.recordcount & "记录"
'on error resume next
'connstr="dsn=mmaximo;uid=user;pwd=pwd"
'Conn.open connstr
%>
---------------------------------------------------------------
方法二:Dim objConn,myDSN
If Not IsObject(objConn) Then
Set objConn = Server.CreateObject("ADODB.Connection")
myDSN = "Provider=OraOLEDB.Oracle;Data Source=Oracle_Shanghai;User ID=scott;PASSWORD=tiger;Persist Security Info=True"
objConn.Open myDSN
End If
赞同