Page 1 of 1

Is dblink supported on CoreLab.PostgreSql(or Data).dll?

Posted: Mon 09 Feb 2009 11:07
by albyu2
Hi everybody!
I download and licenced this drivers "pgsqlnet375std2.exe" for .NET.
I made a complete installation and I'm referencing this 2 dll in my project:
- CoreLab.Data;
- CoreLab.PostreSql

I need to execute an UPDATE from the Database A to DataBase B. I do this command with DBLINK on PgAdmin and everything works!
I can't do this in .NET C#, here is the code:

Code: Select all

CoreLab.PostgreSql.PgSqlTransaction tran = this.Adapter.InsertCommand.Connection.BeginTransaction();

cmdText = "SELECT dblink_exec(, 'UPDATE schemaX.tabY SET id = {0} WHERE objectid = {1}')";
cmdText = string.Format(cmdText, myVar1, myVar2);

command =
	new CoreLab.PostgreSql.PgSqlCommand(
	cmdText, tran.Connection, tran);

command.ExecuteNonQuery();

tran.Commit();
this generate an Exception on 'command.ExecuteNonQuery();', which is:

Code: Select all

Message: function dblink_exec(text, unknown) does not exist
ErrorCode: 42883
FileName: .\src\backend\parser\parse_func.c
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
ProcedureName: ParseFuncOrColumn
Source: CoreLab.PostgreSql
StackTrace:   in CoreLab.PostgreSql.a.d(Boolean A_0)
   in CoreLab.PostgreSql.a.ae()
   in CoreLab.PostgreSql.a.b(String A_0)
   in CoreLab.PostgreSql.a.l()
   in CoreLab.PostgreSql.PgSqlCommand.a(Boolean A_0, Int32 A_1, Int32 A_2)
   in CoreLab.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
   in System.Data.Common.DbCommand.ExecuteReader()
   in CoreLab.Common.DbCommandBase.ExecuteNonQuery()
   in It.Pit4.Sim.DGis.Common.DataSetImpresaTableAdapters.impresaTableAdapter.InsertImpresa(Int32 GIdImpresa) in C:\sim\sim\src\client\SimGui\Common\DataSetImpresa.cs:riga 185
Please, can anyone help me to solve this??? :roll:
Thank you so much! :wink:
A.

Posted: Tue 10 Feb 2009 09:15
by Shalex
dotConnect for PostgreSQL works with the functions of the DBLink package normally. The error you are getting says that your PostgreSQL server doesn't have the dblink.dll module built in. Please make sure that this query with the same database works normally via PgAdmin. Refer to the PostgreSQL documentation to find out how to make dblink.dll work.

Please notify us about the results.

Posted: Mon 16 Feb 2009 08:38
by albyu2
As I said in my first message, this query works via PgAdmin!
Should I add the dblink.dll to my project? Where is this dll?

NB: in \PostgreSQL\8.3\lib there is the dblink.dll and it works in PgAdmin, I can't add it to my project.