2

I am currently working on a 3.5 .NET C# Project. it uses an external program that takes an argument when I build and run it. The external program goes to index a structured or an unstructured source of data.

The C# project is a simple .dll that override some of the external program methods. At the initialization part, I do request a connection to my postgreSQL DB in order to get back a unique ID.

WARNING : Indexer and my DB have no link, Indexer can index folder with .xls files, or mysql DB. My PostgreSQL is here just to bring a unique ID and store some important informations

My problem is when I launch as an external program the DBConnector which is a 32 bit indexer, everything goes well.

Whereas when I launch the AlfrescoConnector which is a 64 bit indexer, I can't open my postgreSQL database.

I put the x86 & x64 type of connector but I don't know if the problem comes from there.

I'm working on Visual 2012, my debug is set to produce a x86 compatible program (changing it to "any CPU" or "x64" doesn't solve the problem)

The db object I use is DbClient which is a specific method that you won't find on the internet because it comes from the external program reference, but it works as a classic DbConnector.

My DbClient object looks like this :

  • dbClient = {Sinequa.Common.DbClient}
    • _CurrentTransaction = null
    • ConnectionString = "Server=localhost;Port=5444;User Id=USERSAMPLE;Database=DBSAMPLE;Password=PWDSAMPLE;"
    • DbCn = null
    • DbCnSubSelect = null
    • DbFactory = null
    • DbIsolationLevel = Unspecified
    • DefaultCommandBehavior = SequentialAccess
    • Engine = Postgres
    • Error = 0
    • ErrorText = null
    • LastRowAffected = 0
    • LOBFetchSize = 0
    • Provider = "Npgsql"
    • RefreshCount = 0
    • RefreshCurrent = 0
    • Schema = null

The error comes when I do myDbClient.Open() with the Alfresco one

Any suggestions ? Need more details ? I'm ready to solve this painful error with you my fellows !

1
  • Inspecting the log files generated by the connector named Alfresco, I succeed into discriminating the source of the problem : "DbClient.Open error : Unable to find the requested .Net Framework Data Provider. It may not be installed." The one I currently use is Npgsql. Is making reference to Npgsql will fill the lack of information included directly into the connector ? I'll experiment by my side, but feel free to add some valuable answers to this topic. Commented Oct 2, 2013 at 12:33

1 Answer 1

2

The Alfresco x64 bit connector use the x64 bit of the .NET configuration file. The configuration files located at:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.conf
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.conf
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.conf
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.conf

Remember that the problem is the missing provider. So to solve this problem you have to insert the lacking provider between the DbProviderFactories tag like this:

<DbProviderFactories>
  <add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  <add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Framework Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.13.91, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"/>
  <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
  <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>

With this insert the next time the DbClient will try to open the Database and get the asked provider, it will succeed.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.