Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oracle connection open error

Tags:

People also ask

Where can I find connection string in Oracle?

Privileged Connections Oracle allows database administrators to connect to Oracle Database with either SYSDBA or SYSOPER privileges. Data Source=myOracle;User Id=myUsername;Password=myPassword;DBA Privilege=SYSDBA; SYSOPER is also valid for the DBA Privilege attribute.


I use QTP/UFT for my application testing. I had to access my oracle DB (11g) to do some DB setup (to update records).

I use oracle.manageddataaccess.dll (referenced to myDBWrapper class library project).

I have below dlls

(myDBWrapper is the one I created - where the issue is present)

enter image description here

My connection string:

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<HOST>)(PORT=<PORT>>)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=<SERVICENAME>)));User Id=<USERNAME>;Password=<PASSWORD>;

Issue:

The below code during conn.open() throws error. It works sometimes & sometimes throws an error that 'Object reference not to set an instance of an object' in the same machine.

conn = New OracleConnection()
conn.ConnectionString = ConnectionString
MsgBox("isnothing? : " & (conn Is Nothing).ToString)   'it is always False. So , not null

conn.Open()  ' It throws an error that "Object reference not to set an instance of an object"

Dim cmd As OracleCommand = New OracleCommand(strQuery)
cmd.BindByName = True
cmd.Connection = conn
RowsAffected = cmd.ExecuteNonQuery()
cmd.Dispose()
conn.Dispose()

Note:

It is not a resource leak. I just make 1 connection and dispose. No one else is connecting to the DB.

Issue happens - When QTP has COM lib. When i use that to automate & make it invisible (QTP.Visible = FALSE). If I use QTP.Visible = TRUE - issue does not happen. What kind of issue is this!!!

StackTrace :

Object reference not set to an instance of an object.
   at OracleInternal.I18N.Conv.GetMaxBytesPerChar(Int32 charsetId)
   at OracleInternal.ServiceObjects.OracleConnectionImpl.Connect(ConnectionString cs, Boolean bOpenEndUserSession)
   at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd)
   at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd)
   at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword)
   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()
   at myDBWrapper.Utility.DBUtil.OpenConnection()