Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > error to connect ASP page to Oracle

Reply
Thread Tools

error to connect ASP page to Oracle

 
 
jrefactors@hotmail.com
Guest
Posts: n/a
 
      09-22-2005
My machine is Windows XP with Oracle 9.2 Home; IIS and Oracle
are in the same box.

I have tried both Oracle OLEDB Provider and Microsoft ODBC For Oracle,
but both not working.

For Microsoft ODBC For Oracle approach, I added a data source
in Oracle Data Source Administrator, in System DSN tab, I created
a system data source named OracleDSN with Microsoft ODBC for Oracle.

I got the following errors for ASP page connect to Oracle database.
However, it works fine for VB application connect to Oracle database
with the same data source.


Approach #1: Oracle OLEDB Provider
==================================

cst = "Provider=MSDAORA;" & _
"Data Source=ORCL;" & _
"User ID=scott;" & _
"Password=tiger;"

Error Type:
Microsoft OLE DB Provider for Oracle (0x80004005)
Oracle client and networking components were not found. These
components are supplied by Oracle Corporation and are part of the
Oracle Version 7.3.3 or later client software installation. Provider is
unable to function until these components are installed.


Approach #2: Microsoft ODBC For Oracle
======================================

cst = "dsn=OracleDSN;uid=scott;pwd=tiger;"

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on
SQL_HANDLE_ENV failed


Here's the ASP code:
<%
Set objConn = Server.CreateObject("ADODB.Connection")

'Approach #1: Oracle OLEDB Provider
cst = "Provider=MSDAORA;" & _
"Data Source=ORCL;" & _
"User ID=scott;" & _
"Password=tiger;"

'Approach #2: Microsoft ODBC For Oracle
'cst = "dsn=OracleDSN;uid=scott;pwd=tiger;"

objConn.Open cst

Set objRs = objConn.Execute("SELECT * FROM DEPT")
Response.Write "<table border=1>"
For I = 0 To objRS.Fields.Count - 1
Response.Write "<tr>"
Response.Write "<td><b>" & objRS(I).Name & "</b></td>"
Response.Write "</tr>"
Next
Response.Write "</table>"
objRs.Close
objConn.Close
%>



any ideas? please advise.

thanks!!

 
Reply With Quote
 
 
 
 
takveen@gmail.com
Guest
Posts: n/a
 
      09-22-2005
Did you configure OracleNet for the client or in other words
tnsnames.ora file?

My suggestion would be to create a service name using Oracle Net
Manger. Then in ODBC (Administrative tools) -> DSN -> System tools
create Data Source Name by clicking add. Select the driver for Oracle.
Then provide necessary information including the service name u created
using Oracle Net Manger, login & password. Then test the connection...

Thanks,

Asim Abbasi
Takveen, Inc.

 
Reply With Quote
 
 
 
 
Brijesh
Guest
Posts: n/a
 
      09-22-2005
Dave is right. What you are doing here is using the Microsoft Driver
for Oracle. This is not oracle objects for OLE, in which case your
Provider becomes "OraOLEDB.Oracle".
You might wanna try the ODBC approach as well, of course after you
configure the Oracle Net names. First of all, make sure you are able to
connect to Oracle, using any tool like SQLPlus., then go further.
Install the Oracle ODBC driver for your oracle version on your PC
running IIS, and configure a DSN using the ODBC Administrator. You can
also test the connection from the ODBC Administrator tool after you
create your connection and make sure that everything is right...

Brijesh Mathew

 
Reply With Quote
 
jrefactors@hotmail.com
Guest
Posts: n/a
 
      09-22-2005
More questions to clarify...

1) In ODBC Data Source Administrator, in System DSN tab, when
I add a new data source, I will see the list of data source.
"Oracle in OraHome92" actually means Oracle ODBC Driver 9.2?

2) ODBC Data Source Administrator only shows the list of
ODBC drivers, we couldn't see any OLE-DB Providers in the list.
For OLE-DB Providers, we can see that when using UDL trick.
Is that correct?

3) For ASP application to connect to Oracle database,
which of the following is the best driver to choose? Why?
How do we choose? My understanding is that OLE-DB is better
than ODBC. Is that correct? Is that because we don't need
to setup DSN in ODBC Data Source Administrator?

Microsoft OLD DB Provider for Oracle
Oracle Provider for OLE-DB
Oracle ODBC


Please advise more... thanks!!

 
Reply With Quote
 
Brijesh
Guest
Posts: n/a
 
      09-23-2005
1) Yes. If you see Oracle in Orahome92 in ODBC Administrator, that
means you have the Oracle ODBC Driver Installed.
2) You will not see Oracle OLE DB Providers in the list of ODBC
drivers, as it is not an ODBC Driver. First of all, you should
understand the fact that you should use ODBC driver in a scenario where
you do not have any other choices. If you have a better Driver to
connect to the DB, always use that..!
3) OLE DB is always better than ODBC by all means. With ODBC, you will
be restricted to only certain DB specific tasks unlike the OLE DB
driver. Speedwise, from my experience, OLE DB is always been better.
Check that you have Oracle OLE DB drivers installed. Goto oracle
universal installer, and in the section Oracle Programmer, you will see
Oracle OLE db.
Configure your tnsnames before you do anything. Make sure you are able
to connect to Oracle from SQLPlus, or any other tool. If you are using
ODBC, while you create a DSN, you will see an area where you have to
specify TNS service name. Create this tnsname and make sure you are
able to connect to DB, then proceed.
Whatever drivers you are using, be it ODBC, or MSDAORA, or Oracle OLE
db Provider, you need the net service name to connect to DB.
Hope that helps

Brijesh Mathew

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified procedure could not be found at C:/Perl/lib/DynaLoader.pm line 230. Feyruz Perl Misc 4 10-14-2005 06:47 PM
RE: Oracle beginner problem: can't connect to Oracle using cx_Oracle Pieter Claerhout Python 0 01-28-2004 01:13 PM
Oracle beginner problem: can't connect to Oracle using cx_Oracle Benson, John Python 1 01-28-2004 12:55 PM
Re: Error Connecting to Oracle after an Oracle shutdown David Rudder Java 0 07-30-2003 01:22 PM
Re: Error Connecting to Oracle after an Oracle shutdown Juha Laiho Java 0 07-30-2003 10:22 AM



Advertisments