Solved

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

Posted on 2008-06-20
5
2,081 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 14

Expert Comment

by:ajexpert
ID: 21833734
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
ID: 21837595
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
ID: 22038259
did you have any luck?
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

724 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