mcse20002000
asked on
ASP-Oracle9i COnnection Problem.
Hi People.
i have installed Oracle OLEDB Provider but i am unable to connect to the Oracle 9i DB.
My Page Looks like this
<%
Set objConn = Server.CreateObject("ADODB .Connectio n")
objConn.Open "Provider=OraOLEDB.Oracle. 1;Persist Security Info=False;User ID=scott;Password=tiger;Da ta Source=ned;"
Set objRs = objConn.Execute("SELECT * FROM EMPLOYEE")
Response.Write "<table border=1 cellpadding=4>"
Response.Write "<tr>"
For I = 0 To objRS.Fields.Count - 1
Response.Write "<td><b>" & objRS(I).Name & "</b></td>"
Next
Response.Write "</tr>"
Do While Not objRS.EOF
Response.Write "<tr>"
For I = 0 To objRS.Fields.Count - 1
Response.Write "<td>" & objRS(I) & "</td>"
Next
Response.Write "</tr>"
objRS.MoveNext
Loop
Response.Write "</table>"
objRs.Close
objConn.Close
%>
Error i get is :
Error Type:
ADODB.Connection (0x800A0E7A)
Provider cannot be found. It may not be properly installed.
i have installed Oracle OLEDB Provider but i am unable to connect to the Oracle 9i DB.
My Page Looks like this
<%
Set objConn = Server.CreateObject("ADODB
objConn.Open "Provider=OraOLEDB.Oracle.
Set objRs = objConn.Execute("SELECT * FROM EMPLOYEE")
Response.Write "<table border=1 cellpadding=4>"
Response.Write "<tr>"
For I = 0 To objRS.Fields.Count - 1
Response.Write "<td><b>" & objRS(I).Name & "</b></td>"
Next
Response.Write "</tr>"
Do While Not objRS.EOF
Response.Write "<tr>"
For I = 0 To objRS.Fields.Count - 1
Response.Write "<td>" & objRS(I) & "</td>"
Next
Response.Write "</tr>"
objRS.MoveNext
Loop
Response.Write "</table>"
objRs.Close
objConn.Close
%>
Error i get is :
Error Type:
ADODB.Connection (0x800A0E7A)
Provider cannot be found. It may not be properly installed.
Do you have the orracle TNS names entry set up properly? Looking at the code it would be called 'ned'?
Try changing the provider from OraOLEDB.Oracle.1 to MSDAORA
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, MSDAORA has limitations such as you can't acess clobs and blobs.
Here's what I mean about the vbs script...
Create test.vbs with the following code then exucte it at the command prompt...
Set rs = CreateObject("ADODB.Record set")
cnstr = "Provider=OraOLEDB.Oracle. 1;Persist Security Info=False;User ID=scott;Password=tiger;Da ta Source=ned;" rs.Open "select sysdate from dual", cnstr, 3, 3
WScript.echo rs("sysdate")
rs.Close
Set rs = Nothing
Create test.vbs with the following code then exucte it at the command prompt...
Set rs = CreateObject("ADODB.Record
cnstr = "Provider=OraOLEDB.Oracle.
WScript.echo rs("sysdate")
rs.Close
Set rs = Nothing
I use Oracle 9i and the code below works. (This assumes that Oracle is installed in the default port. If not, then the port # must be included in the connection string)
Try something like this:
StrConnect="Provider=MSDAO RA.1;Data Source=database_scheme;Use r Id=user_name;PASSWORD=data base_passw ord;"
set objConnection=server.creat eobject("a dodb.conne ction")
objConnection.open StrConnect
varSQL = "SELECT DISTINCT USER_ID FROM EMPLOYEE"
set rstemp = objConnection.Execute(varS QL)
Do While NOT temp_record_set .EOF
Response.Write "<td><b>" & rstemp (0) & "</b></td>"
rstemp.MoveNext
Loop
rstemp.close
set rstemp=nothing
objConnection.close
set objConnection=nothing
Try something like this:
StrConnect="Provider=MSDAO
set objConnection=server.creat
objConnection.open StrConnect
varSQL = "SELECT DISTINCT USER_ID FROM EMPLOYEE"
set rstemp = objConnection.Execute(varS
Do While NOT temp_record_set .EOF
Response.Write "<td><b>" & rstemp (0) & "</b></td>"
rstemp.MoveNext
Loop
rstemp.close
set rstemp=nothing
objConnection.close
set objConnection=nothing
ASKER