Não esta conectando via codigo no SQLConnection do dbexpress

Delphi

03/01/2013

Estou criando um programa para criar uma base de dados no firebird e depois dela criada ela conecta no base.
para criar usa a seguinte procedure:
procedure TDM.novabasededados(nome: string);
var
IBDatabase: TIBDatabase;
begin
IBDatabase := TIBDatabase.Create(Self);
try
IBDatabase.DatabaseName := driver+':\SQLBacala\Base de Dados\' + nome + '.FDB';
IBDatabase.Params.Add('USER ''SYSDBA''');
IBDatabase.Params.Add('PASSWORD ''masterkey''');
IBDatabase.Params.Add('PAGE_SIZE 4096');
IBDatabase.Params.Add('DEFAULT CHARACTER SET WIN1252');
IBDatabase.CreateDatabase;
finally
IBDatabase.Free;
end;

conectar(nome + '.FDB');
end;

Até aqui funciona quando entra na procedure conectar que é o seguinte:

"procedure TDM.conectar(nome: string);
begin
SqlConnection.Connected := false;
sqlconnection.ConnectionName := 'FBConnection';
sqlconnection.DriverName := 'Firebird';
SqlConnection.Params.Add('DataBase='+driver+':\SQLBacala\Base de Dados\' + nome);
SqlConnection.Params.Add('User_Name=SYSTEM');
SqlConnection.Params.Add('Password=mastekey');
SqlConnection.GetDriverFunc := 'getSQLDriverINTERBASE';
SqlConnection.LibraryName := 'dbxfb.dll';
SqlConnection.VendorLib := 'fbclient.dll';
SqlConnection.Connected := true;

if SqlConnection.Connected then
begin
with sqlquery do
begin
SQLConnection := SqlConnection;
close;
open;
end;

if not sqlquery.IsEmpty then
begin
FrmSQLBacala.TreeDataBase.Items.Add(nil,SQLQueryRDBCHARACTER_SET_NAME.AsString);

With FrmSQLBacala.BarPage.Caption do
caption := caption + '-' + SQLQueryRDBCHARACTER_SET_NAME.AsString;
end;

exit;
end
else
begin
Mensagem(5,0);
exit;
end;

end;"

Aparecere o seguinte erro:
I/O error during "Create file (open)" operation for file "database.fdb"
Error while trying to open file.
Sistema não ode encontrar o arrquivo existente.

Alguem sabe me dizer onde eu errei????

Obrigado e "Deus o abençoe"
Wilton Júnior

Wilton Júnior

Curtidas 0

Melhor post

Alisson Santos

Alisson Santos

14/01/2013

A duvida foi resolvida, conseguiu ser sanada?
GOSTEI 1

Mais Respostas

Francielio Medeiros

Francielio Medeiros

03/01/2013

Já tentou olhar isso aqui.
Errado:
SqlConnection.Params.Add('Password=mastekey');


Certo:
SqlConnection.Params.Add('Password=masterkey');



espero ter Ajudado!
GOSTEI 0
Eduardo Richeli

Eduardo Richeli

03/01/2013


IBDatabase.DatabaseName := driver+'localhost:c:\SQLBacala\Base de Dados\' + nome + '.FDB';


Estou criando um programa para criar uma base de dados no firebird e depois dela criada ela conecta no base.
para criar usa a seguinte procedure:
procedure TDM.novabasededados(nome: string);
var
IBDatabase: TIBDatabase;
begin
IBDatabase := TIBDatabase.Create(Self);
try
IBDatabase.DatabaseName := driver+':\SQLBacala\Base de Dados\' + nome + '.FDB';
IBDatabase.Params.Add('USER ''SYSDBA''');
IBDatabase.Params.Add('PASSWORD ''masterkey''');
IBDatabase.Params.Add('PAGE_SIZE 4096');
IBDatabase.Params.Add('DEFAULT CHARACTER SET WIN1252');
IBDatabase.CreateDatabase;
finally
IBDatabase.Free;
end;

conectar(nome + '.FDB');
end;

Até aqui funciona quando entra na procedure conectar que é o seguinte:

"procedure TDM.conectar(nome: string);
begin
SqlConnection.Connected := false;
sqlconnection.ConnectionName := 'FBConnection';
sqlconnection.DriverName := 'Firebird';
SqlConnection.Params.Add('DataBase='+driver+':\SQLBacala\Base de Dados\' + nome);
SqlConnection.Params.Add('User_Name=SYSTEM');
SqlConnection.Params.Add('Password=mastekey');
SqlConnection.GetDriverFunc := 'getSQLDriverINTERBASE';
SqlConnection.LibraryName := 'dbxfb.dll';
SqlConnection.VendorLib := 'fbclient.dll';
SqlConnection.Connected := true;

if SqlConnection.Connected then
begin
with sqlquery do
begin
SQLConnection := SqlConnection;
close;
open;
end;

if not sqlquery.IsEmpty then
begin
FrmSQLBacala.TreeDataBase.Items.Add(nil,SQLQueryRDBCHARACTER_SET_NAME.AsString);

With FrmSQLBacala.BarPage.Caption do
caption := caption + '-' + SQLQueryRDBCHARACTER_SET_NAME.AsString;
end;

exit;
end
else
begin
Mensagem(5,0);
exit;
end;

end;"

Aparecere o seguinte erro:
I/O error during "Create file (open)" operation for file "database.fdb"
Error while trying to open file.
Sistema não ode encontrar o arrquivo existente.

Alguem sabe me dizer onde eu errei????

Obrigado e "Deus o abençoe"
GOSTEI 0
Wilton Júnior

Wilton Júnior

03/01/2013

sim obrigado
GOSTEI 0
POSTAR