Unable to connect Oracle DB - throws an error Attempt to load Oracle client libraries threw BadImageFormatException

Hi

I am trying to connect Oracle DB using the UiPath Database connect activity.

Connection String:
“Data Source=(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = portnumber)))(CONNECT_DATA = (SERVICE = SERVICEName)(SERVER = DEDICATED)));uid=userid;Pwd=password”

Provider name:System.Data.OracleClient”.

It throws an error with the message:
Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

Please find attached the complete log.

Able to connect the database using Oracle SQL Developer and I installed Oracle 11g 64 bit client software and placed the TNSNAMES.ORA file.

Kindly advice to fix this issue.

Complete Log:
Exception Type: InvalidOperationException

System.InvalidOperationException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed. —> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at System.Data.Common.UnsafeNativeMethods.OCILobCopy2(IntPtr svchp, IntPtr errhp, IntPtr dst_locp, IntPtr src_locp, UInt64 amount, UInt64 dst_offset, UInt64 src_offset)
at System.Data.OracleClient.OCI.DetermineClientVersion()
— End of inner exception stack trace —

Server stack trace:
at System.Data.OracleClient.OCI.DetermineClientVersion()
at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
at System.Data.OracleClient.OracleInternalConnection…ctor(OracleConnectionString connectionOptions)
at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OracleClient.OracleConnection.Open()
at UiPath.Database.DatabaseConnection.OpenConnection()
at UiPath.Database.DatabaseConnection…ctor(String connectionString, String providerName)
at UiPath.Database.Activities.DatabaseConnect.<>c__DisplayClass12_0.b__0()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object args, Object server, Object& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at System.Func`1.EndInvoke(IAsyncResult result)
at UiPath.Database.Activities.DatabaseConnect.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Regards,
Ganesh

I am getting a same issue… Please help

Hi,
I had the same problem and was able to solve it by installing the 32-bit version of the Oracle client in addition to the 64-bit version. I know it sounds counterintuitive, especially given the error message, but both myself and several others solved it by installing both. This thread at the Oracle forums discusses the issue: running in 64 bit mode with the 32 bit Oracle client installed — oracle-tech.

You can download both the 32-bit version and the 64-bit version here: Database Software Downloads | Oracle. You can choose the 18c version even if your Oracle DB is 11g on premise, so just choose the last one.

Hope this helps,
Cheers, Kristian

4 Likes

This solution worked for me… Thanks

1 Like

I uninstalled the 64 bit Oracle version and installed the 32 bit version and the issue got solved.

1 Like