Problem loading Oracle client libraries when running in a NAnt build
- by Chris Farmer
I am trying to use dbdeploy to manage Oracle schema changes. I can run it successfully from the command line to get it to generate my change scripts, but when I try to execute it via the dbdeploy NAnt task running through TeamCity, I get an error:
System.Data.OracleClient requires Oracle client software
version 8.1.7 or greater.
I do have the Oracle 10.2.0.2 client software installed. It's the first entry in the system path, and the dbdeploy.exe app is able to successfully negotiate an Oracle connection. The dbdeploy code dynamically loads the System.Data.OracleClient assembly, which in-turn tries to use the Oracle client bits to talk to the database. This is what is failing in my NAnt environment.
I have verified the following points:
The same user identity is running the process in both cases
The same working directory is used in both cases
The same dbdeploy code is running in both cases and with the same supplied parameters
The same database connection string is being used in both cases
The same ADO.NET assembly is being dynamically loaded in both cases (System.Data.OracleClient, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
Here's the top of the stack trace during the error:
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 Net.Sf.Dbdeploy.Database.DatabaseSchemaVersionManager.
GetCurrentVersionFromDb()
My main question is this: how can I discover what's different about these running environments to see why my Oracle client software can't be loaded?