Question

Please i have a serious problem here. When i want to debug my application in visual studio i have this message box error : "The ordinal 133 could not be located in the dynamic link library LIBPQ.dll". this dll belongs to PostgreSQL 8.3.8. Note that i'm using also ArcSDE 10. After that it give me the following message in visual studio "Server library could not be loaded". Here there is the code that i use for my connection to arcsde. Normally it did work before in my other applications.

class sdeConnection
    {
        IWorkspace m_pWorkSpace;
        NpgsqlConnection m_pCnx;
        IFeatureWorkspace m_pFeatWorkSpace;
        ISqlWorkspace m_pSqlWorkSpace;
        string m_version;               

// Version of the database to be used for the update data
    public sdeConnection()
    {
        // ArcSDE Connexion 
        Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SqlWorkspaceFactory");
        IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);

        // create the connection to the database server
        IPropertySet pCnxProp = new PropertySet();
        pCnxProp.SetProperty("dbclient", "PostgreSQL");
        pCnxProp.SetProperty("serverinstance", "localhost");
        pCnxProp.SetProperty("instance", "5432");
        pCnxProp.SetProperty("authentication_mode", "DBMS");
        pCnxProp.SetProperty("database", "sde");
        pCnxProp.SetProperty("user", "sde");
        pCnxProp.SetProperty("password", "geoserver");

        // Creation of the workspace
        m_pWorkSpace = workspaceFactory.Open(pCnxProp, 0); **it gave the second error here (Server library could not be loaded)**

        // Npgsql Connextion 

        m_pCnx = new NpgsqlConnection("server=localhost;port=5432;database=sde;user=sde;pwd=geoserver");

    }
}
Was it helpful?

Solution

i finally found where was the problem. When installing postgres , i added the path of it to the environment variable. So it created a copy of library of postgress in the windows32 folder . So there was a consfusion between libraries. So i removed the path in the environment variable and i deleted all librairies created in the win32 folder. it work very well now :).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top