HomeActive Query BuilderConnect PgSQL

Connect PgSQL


Is it possible to connect PgSQL database from Active Query Builder?
Humayun Kabir | email
September 2 2007, 07:36 AM
Yes, it is possible using the VCL and ActiveX Editions of Active Query Builder. Ability to connect to PostgreSQL and support of PostgreSQL dialect in the .NET Edition will be added soon.
Sergey Smagin | email
3 days, 21 hours since original post
I am trying to connect PgSql from my dont net application using "Npgsql".

CODE
----

private string m_server = "192.168.1.101";
private string m_username = "gpadmin";
private string m_password = "123456";
private string m_database = "rulemanagement_tmp";

private string GetConnectionString()
{
return "server=" + m_server + "; user id=" + m_username + "; password=" + m_password + "; database=" + m_database;
}

private void ConnectDB()
{
NpgsqlConnection con = new NpgsqlConnection();
con.ConnectionString = GetConnectionString();
con.Open();
}
************************************************************
Now how can i pass this connection to my "axActiveQueryBuilder". Please give a clear view..
Thanks in advance..
Humayun Kabir | email
3 days, 23 hours since original post
Dear Humayun,

ActiveX Edition works through ADO connection to work with any database, thus it is not possible to use standard .NET connection. You should prepare another connection string in order to work with ADO ODBC provider to connect to PostgreSQL database.

This is the sample ADO connection string for PostgreSQL:

Provider=MSDASQL.1;Password=**password**;Persist Security Info=True;User ID=postgres;Extended Properties="DRIVER=PostgreSQL Unicode;DATABASE=**database name**;SERVER=**server name**;PORT=5432;SSLmode=disable;ReadOnly=0;Protocol=7.4-1;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;Socket=4096;UnknownSizes=0;MaxVarcharSize=255;MaxLongVarcharSize=8190;Debug=0;CommLog=0;Optimizer=1;Ksqo=1;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;;LFConversion=1;UpdatableCursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrepare=0;LowerCaseIdentifier=0;XaOpt=1"

You should pass this string to the ConnectionString property and set the Connected property to True.

If you don't feel convenient to use another database connection for the query builder component, you may act in the following way:

1) Set the OfflineMode property to True and connect to your PostgreSQL database with connection string above.

2) Save all metadata to the XML file by calling the MetadataContainer.SaveToXMLFile method.

After that you may not connect to PostgreSQL at all and load metadata from XML file using the LoadFromXMLFile method.

Another way is to wait a month for the .NET PostgreSQL metadata provider implementation in the .NET Edition of Active Query Builder.

Feel free contact us with any additional questions.
Sergey Smagin | email
4 days since original post
This topic is closed