Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problemi TSQLConnection con D2010

21 views
Skip to first unread message

A

unread,
Dec 19, 2009, 6:31:42 AM12/19/09
to
Delphi 2010, componente DbExpress TSQLConnection,
ConnectionName vuoto
Driver Firebird
LibraryName dbxfb.dll
VedorLib fbclient.dll

uso questa funzione

function Tfrm_DatiFb.ConnettiDataBase(var NomeDataBase: string): Boolean;
begin
try
SQLConnection1.Params.Values['Database'] := NomeDataBase;
SQLConnection1.Params.Values['DriverName'] := 'Interbase';
SQLConnection1.Params.Values['User_Name'] := 'sysdba';
SQLConnection1.Params.Values['password'] := 'masterkey';
SQLConnection1.LoginPrompt := False;
SQLConnection1.Connected := True;
Result := True
except
Result := False;
end;
end;

a RunTime al momento dell'esecuzione di Connected := True;
ottengo

** eccezione a RunTime
exception TDBXError with message the GDS32.DLL Library (error code 127)
The GDS32.DLL may be missing from the system path
or you have an incompatibe version of the library installed

Se provo ad impostare manualmente DataBase con il path dove si trova il
DB Firebird, tramite Params, e poi imposto Connected := True , ho

** eccezione a DesignTime
Cannot load fbclient.DLL library (error code 126)
The fbclient.DLL may be missing from the system path
or you have an incompatibe version of the library installed

FbClient.DLL si trova su C:\Programmi\Firebird\Firebird_2_1\bin
che riporta la data del 27/02/2009
GDS32.DLL si trova su Windows\System32 con data 22/07/2009

Su Delphi Options in Library-win32 ho aggiunto il path sia di
FbClient.dll che GDS32.DLL
sia su LoibraryPath che su Browsing Path

ho provato anche ad usare il Driver interbase, ma ottengo le stesse
eccezioni.

il Db e' funzionante, con IBExpert si apre regolarmente

Maurizio

Alberto Salvati

unread,
Dec 19, 2009, 10:20:40 AM12/19/09
to
> function Tfrm_DatiFb.ConnettiDataBase(var NomeDataBase: string): Boolean;

xche il nome del db è un var e non un const?
A parte cio, non ho capito se il db e' fb o interbase.
Se e' fb, faresti bene a documentart bene sul relativo sito per cio
che riguarda le compatbilita' dei driver dbx.

Infine, questa cosa qua:

>   except
>     Result := False;
>   end;
> end;


e' MALE, MOLTO MALE.
Finche' sei a designtime, dentro delphi e con attiva l'opzione di stop
on delphi exception ok..
Ma a runtime saprai che la connessione e' fallita ma non saprai il
xche del faillimento, con le ovvie (non per tutti...) conseguenze del
caso.

A.

A

unread,
Dec 19, 2009, 12:33:30 PM12/19/09
to
"Alberto Salvati" ha scritto

>A parte cio, non ho capito se il db e' fb o interbase.
>Se e' fb, faresti bene a documentart bene sul relativo sito per cio
>che riguarda le compatbilita' dei driver dbx.

il problema e' nel driver dbxfb4d14.dll che non e' presente, ma che si
trovano http://sites.google.com/site/dbxfirebird/download, e nel settare
a mano un po di parametri.

questa funzione si connette a Firebird, essendo in un datamodule ritorna una
stringa con l'eventuale errore, da gestire nel form chiamante.

Mi viene un'idea, sarebbe possibile trasformare tutte le varie
SQLConnection1 in una classe ? , se si datemi una traccia di avvio.

Maurizio

// Test connessione Db Fb su Delphi 2010
//-----------------------------------------
//test con 1 form ed 1 datamodule contenente solo SqlConnection
//-----------------------------------------------------------------

function Tfrm_DatiFb.ConnettiDataBase(var NomeDataBase: string): string;
begin
try
SQLConnection1.Params.Clear;
SQLConnection1.LoadParamsOnConnect:=False;
SQLConnection1.ConnectionName:='FBCOnnection';
SQLConnection1.LibraryName:='dbxfb4d14.dll';
SQLConnection1.VendorLib:='fbclient.dll';
SQLConnection1.GetDriverFunc:='getSQLDriverInterBase';

SQLConnection1.Params.Add('DriverName=FirebirdConnection');
SQLConnection1.Params.Add('RoleName=Normal');
SQLConnection1.Params.Add('LongStrings=True');
SQLConnection1.Params.Add('EnableBCD=True');
SQLConnection1.Params.Add('UseQuoteChar=False');
SQLConnection1.Params.Add('FetchAll=False');
SQLConnection1.Params.Add('CharLength=0');
SQLConnection1.Params.Add('Charset=ISO8859_1');
SQLConnection1.Params.Add('SQLDialect=3');
SQLConnection1.Params.Add('BlobSize=-1');
SQLConnection1.Params.Add('CommitRetain=False');
SQLConnection1.Params.Add('WaitOnLocks=False');
SQLConnection1.Params.Add('ErrorResourceFile=');
SQLConnection1.Params.Add('LocaleCode=0000');
SQLConnection1.Params.Add('IsolationLevel=ReadCommitted');
SQLConnection1.Params.Add('Interbase TransIsolation=ReadCommitted');
SQLConnection1.Params.Add('UseUnicode=False');
SQLConnection1.Params.Add('Trim Char=False');

SQLConnection1.Params.Values['Database']:=NomeDataBase;


SQLConnection1.Params.Values['User_Name']:= 'sysdba';
SQLConnection1.Params.Values['password']:= 'masterkey';

SQLConnection1.LoginPrompt:=False;
SQLConnection1.Connected:=True;

Result:='ok'
except
on e:exception do
Result:= e.Message;
end;
end;

0 new messages