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
Solved

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

Posted on 2008-06-20
5
2,076 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup

829 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