Solved

Oracle Connection String: Error: Driver's SQLAllocHandle on SQL_HANDLE_ENV failed

Posted on 2008-06-20
5
2,066 Views
Last Modified: 2013-12-19
I am getting the following error:
ERROR [IM004] [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed

when trying to connect to an oracle database oracle 9i

I have tried the following connection strings
from web config
<add name="connString"  connectionString="Driver={Microsoft ODBC Driver for Oracle}; Server=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = hostval)(PORT = portval)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = servicename)));uid=uidval; pwd=pwdval;"></add>

in dal class
Me.objConn = New OdbcConnection()
Me.objConn.ConnectionString = "Dsn=dsnname;" & _
                                              "Uid=uidtext;" & _
                                              "Pwd=pwdtext;"

The connection strings work fine when I debug on local machine, but fail when the application is on the server.

Any ideas?

0
Comment
Question by:Paulconsulting
  • 2
5 Comments
 
LVL 14

Expert Comment

by:ajexpert
Comment Utility
So are you using DSN or connection string?
Seems you are using DSN which you might have to create it on server.

BTW ODBC driver is very slow.  Why dont you switch to Oracle Driver for .NET?
0
 
LVL 7

Accepted Solution

by:
Dauhee earned 500 total points
Comment Utility
how about:

Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server)(PORT=port))(CONNECT_DATA=(SERVICE_NAME=servic)));User ID=user;Password=pass;

yep better to use ODP as it is native to oracle and inherantly faster. You can keep all your interfaces and just change OdbcConnection to OracleConnection

Imports Oracle.DataAccess.Client

So would be:

Me.objConn = New OracleConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server)(PORT=port))(CONNECT_DATA=(SERVICE_NAME=servic)));User ID=user;Password=pass;")

that way its TNSless and you don't need to go copying tns entries when promoting to different servers
0
 
LVL 7

Expert Comment

by:Dauhee
Comment Utility
did you have any luck?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows how to recover a database from a user managed backup
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now