connect from delphi studio xe, to postgreSQL 9.0

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for PostgreSQL in Delphi and C++Builder
Post Reply
v14n7
Posts: 7
Joined: Sun 06 Mar 2011 15:56
Contact:

connect from delphi studio xe, to postgreSQL 9.0

Post by v14n7 » Sun 06 Mar 2011 16:15

im sory if my english is not good,

its been week, since i got a task from my lecture. I have to make a connection from delphi studio XE to postgre database using devart. but every time i try, its still not working. :cry:

right now, im trying using the newest devart "dbExpress driver 1.40 for PostgreSQL"

n the postgreSQL 9.0. when i wanna try if my connection is success or not from data explorer

this what happen:
"
System.IO.FileNotFoundException: Could not load file or assembly 'Devart.DbxPgsql.DriverLoader, Version=1.0.0.5001, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. The system cannot find the file specified."

what should i do?
im using windows 7 ultimate, is that really matter about what OS i used?

sory for my bad english
:?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 07 Mar 2011 09:09

Hello,

Data Explorer in RAD StudioXE is a .Net application, and dbExpress driver for PostgreSQL don't support .NET for RAD Studio XE for the time being, but we plan to add such support in one of the new versions.

You can use the following code to connect to PostgresSQL:

var
SQLConnection: TSQLConnection;
begin
SQLConnection := TSQLConnection.Create(nil);
SQLConnection.DriverName :='DevartPostgreSQL';
SQLConnection.ConnectionName :='Devart PostgreSQL';
SQLConnection.GetDriverFunc := 'getSQLDriverPostgreSQL';
SQLConnection.LibraryName := 'dbexppgsql40.dll';
SQLConnection.LoginPrompt := False;
SQLConnection.Params.Values['HostName'] := 'host:port';
SQLConnection.Params.Values['Database'] := database';
SQLConnection.Params.Values['SchemaName'] := 'schema';
SQLConnection.Params.Values['User_Name'] := 'user';
SQLConnection.Params.Values['Password'] := 'passwd';
try
SQLConnection.Connected := true;
ShowMessage('OK');
except
on E:Exception do
ShowMessage(e.Message);
end;

v14n7
Posts: 7
Joined: Sun 06 Mar 2011 15:56
Contact:

Post by v14n7 » Mon 07 Mar 2011 09:26

Ok,
Thanks a lot :D

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 07 Mar 2011 09:42

Hello,

If any other questions come up, please contact us.

v14n7
Posts: 7
Joined: Sun 06 Mar 2011 15:56
Contact:

Post by v14n7 » Mon 07 Mar 2011 12:55

is it devart not compatible with windows 7?

or there something else i must do, like moving or copy paste the library from devart to my RAD XE?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 07 Mar 2011 13:57

Hello,

dbExpress Driver for PostgreSQL are fully compatible with Windows 7 x32 and x64.

To develop applications you should only install dbExpress Driver for PostgreSQL on your PC.

To deployment application to end users you should deploy the following additional files on the target computer:
- dbexppgsql40.dll - always required;
- Midas.dll - required by database applications that use client datasets

v14n7
Posts: 7
Joined: Sun 06 Mar 2011 15:56
Contact:

Post by v14n7 » Mon 07 Mar 2011 15:00

when i try to make a simple connection to postgre database using SQLConnection

DriverUnit=DBXDevartPostgreSQL
DriverPackageLoader=TDBXDynalinkDriverLoader,DBXCommonDriver120.bpl
DriverAssemblyLoader=Devart.DbxPgsql.DriverLoader.TCRDynalinkDriverLoader,Devart.DbxPgsql.DriverLoader,Version=1.0.0.1,Culture=neutral,PublicKeyToken=09af7300eec23701
ProductName=PostgreSQL
GetDriverFunc=getSQLDriverPostgreSQL
LibraryName=dbexppgsql40.dll
LocaleCode=0000
IsolationLevel=ReadCommited
MaxBlobSize=-1
UseUnicode=True
blobsize=-1
drivername=DevartPostgreSQL
fetchall=True
HostName=localhost
Database=DBMercu
User_Name=postgres
Password=200904
dsauthenticationpassword=200904
port=5432
SchemaName=public

then i try to connect it
it come out a box of database login:

after a fill in, this is what happen:

"Cannot connect to database
socket error on connect. WSAGetLastError return 11004 ($2AFC)

i feel so stupid,
please help me up,
Thanks before,

what i must do?
sorry if my english was mess up: :oops:

v14n7
Posts: 7
Joined: Sun 06 Mar 2011 15:56
Contact:

Post by v14n7 » Mon 07 Mar 2011 15:48

i'm sorry. The Problem above is allready resolve...

but there's once more

when i try run that connection:

this what happen:

[DCC Fatal Error] Unit1.pas(7): F2051 Unit DBXDevartPostgreSQL was compiled with a different version of DBXCommon.TDBXDriverDef

i use SQLConnection and SimpleDataSet

any idea off this?

v14n7
Posts: 7
Joined: Sun 06 Mar 2011 15:56
Contact:

Post by v14n7 » Tue 08 Mar 2011 13:25

hello alex,

sorry eventually my problem hasn't fixed.

i try what your suggestion,
unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, SqlExpr;

type
TForm2 = class(TForm)
SQLConnection1: TSQLConnection;
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;
SQLConnection: TSQLConnection;
implementation

begin
SQLConnection := TSQLConnection.Create(nil);
SQLConnection.DriverName :='Devart PostgreSQL';
SQLConnection.ConnectionName :='DevartPostgreSQL';
SQLConnection.GetDriverFunc := 'getSQLDriverPostgreSQL';
SQLConnection.LibraryName := 'dbexppgsql40.dll';
SQLConnection.LoginPrompt := False;
SQLConnection.Params.Values['HostName'] := 'localhost:5432';
SQLConnection.Params.Values['Database'] := 'DBMeru';
SQLConnection.Params.Values['SchemaName'] := 'public';
SQLConnection.Params.Values['User_Name'] := 'postgres';
SQLConnection.Params.Values['Password'] := '200904';
try
SQLConnection.Connected := true;
ShowMessage('OK');
except
on E:Exception do
ShowMessage(e.Message);
end;
{$R *.dfm}

end.
when i run this, its fine but latter it became error:
Problem signature:
Problem Event Name: APPCRASH
Application Name: Project2.exe
Application Version: 0.0.0.0
Application Timestamp: 4d762db3
Fault Module Name: KERNELBASE.dll
Fault Module Version: 6.1.7600.16385
Fault Module Timestamp: 4a5bdaae
Exception Code: 0eedfade
Exception Offset: 00009617
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1057
Additional Information 1: 83d0
Additional Information 2: 83d0275eb87dfc2352dfebc9ef09f7ed
Additional Information 3: 86ab
Additional Information 4: 86ab4f53746e2d7edbedcaaa8466c5bf

n with this:
Run Time Error 217 at 0055E1CA

i can't find out what is the problem, because i a newb with this

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 09 Mar 2011 08:37

Hello,

Please change

SQLConnection.DriverName :='Devart PostgreSQL';
SQLConnection.ConnectionName :='DevartPostgreSQL';

to

SQLConnection.DriverName :='DevartPostgreSQL';
SQLConnection.ConnectionName :='Devart PostgreSQL';

and try again.

Post Reply