Fórum Erro ao tentar conectar a base de dados #613974
01/02/2021
0
Em ambiente de produção ao tentar conectar na base acontece esse erro:
'I/O error during "CreateFile (open)" operation for file "C:\TESTE\DB.FDB"
Error while trying to open file
O arquivo já está sendo usado por outro processo. '.
Se o sistema estiver rodando e tentar conectar pelo Ibexpert recebo o erro, se estiver conectado no Ibexpert e eu tentar rodar o sistema recebo também.
Esse erro nunca acontece no debug ou na aplicação rodando na maquina de desenvolvimento já procurei muito no código e não achei quem causa isso.
Segue um pedaço do método de conexão.
var
vArquivo :TiniFile;
caminho: String;
user: String;
pass: String;
charset: String;
DriverId : String;
server: String;
porta : String;
tcp :String;
begin
{Conexão com o Banco de dados}
arquivo:= ExtractFilePath(ParamStr(0));
arquivo:= arquivo + 'Ideiasp.ini';
FDConexao.Params.clear;
FDConexao.Connected:= FALSE;
FDConexao.Params.Clear;
{Carregameto do dados de parametro}
vArquivo:= TIniFile.Create(arquivo);
caminho:= vArquivo.ReadString('CONEXAO','DATABASE',caminho);
user:= vArquivo.ReadString('CONEXAO','USERNAME',user);
pass:= vArquivo.ReadString('CONEXAO','PASSWORD',pass);
charset:= vArquivo.ReadString('CONEXAO','CharacterSet',charset);
DriverId := vArquivo.ReadString('CONEXAO','DriverID',DriverId);
server := vArquivo.ReadString('CONEXAO','Server',server);
porta := vArquivo.ReadString('CONEXAO','Porta',porta);
tcp:='TCPIP';
VIdTabela := vArquivo.ReadString('TABELA','IdTabela',VIdTabela);
{inserir os dados na conexao}
FDConexao.Params.Values['Database']:= caminho;
FDConexao.Params.Values['User_Name']:= user;
FDConexao.Params.Values['Password']:= pass;
FDConexao.Params.Values['CharacterSet']:= charset;
FDConexao.Params.Values['DriverID']:= DriverId ;
FDConexao.Params.Values['Server']:= server;
FDConexao.Params.Values['Protocol']:= tcp;
FDConexao.Params.Values['Pooled']:= 'false';
FDConexao.Params.Values['SQLDialect']:= '3';
FDConexao.Params.Values['GUIDEndian']:= 'Little';
FDConexao.Params.Values['ExtendedMetadata']:='false';
FDConexao.Params.Values['OpenMode']:= 'Open';
FDConexao.Params.Values['CharLenMode']:= 'Chars';
FDConexao.Connected:= TRUE;
Danilo Oliveira
Curtir tópico
+ 0Posts
02/02/2021
Emerson Nascimento
"Classic mode (aka MultiProcess) involves a single listening process that spawns off an additional process for each client connection. Using a locking mechanism, it allows shared connections to database files.
SuperClassic (ThreadedShared) is a single server process. Client connections are handled by separate threads, each having their own database page cache. Other processes (e.g. embedded servers) may open the same database simultaneously (hence the Shared).
Superserver (ThreadedDedicated) is also a single server process with threads handling client connections. There is a single, common database page cache. The server requires exclusive access to each database file it opens (hence the Dedicated)."
https://www.firebirdsql.org/file/documentation/html/en/firebirddocs/qsg3/firebird-3-quickstartguide.html
Gostei + 0
02/02/2021
Danilo Oliveira
"Classic mode (aka MultiProcess) involves a single listening process that spawns off an additional process for each client connection. Using a locking mechanism, it allows shared connections to database files.
SuperClassic (ThreadedShared) is a single server process. Client connections are handled by separate threads, each having their own database page cache. Other processes (e.g. embedded servers) may open the same database simultaneously (hence the Shared).
Superserver (ThreadedDedicated) is also a single server process with threads handling client connections. There is a single, common database page cache. The server requires exclusive access to each database file it opens (hence the Dedicated)."
https://www.firebirdsql.org/file/documentation/html/en/firebirddocs/qsg3/firebird-3-quickstartguide.html
Sim amigo é Firebird 3.0
Me desculpa, mas creio que sua resposta não tem relação direta com meu problema.
Gostei + 0
02/02/2021
Emerson Nascimento
SuperClassic - Other processes may open the same database simultaneously (hence the Shared)
Superserver - The server requires exclusive access to each database file it opens (hence the Dedicated)
mas se não é isso, foi mau...
Gostei + 0
02/02/2021
Danilo Oliveira
SuperClassic - Other processes may open the same database simultaneously (hence the Shared)
Superserver - The server requires exclusive access to each database file it opens (hence the Dedicated)
mas se não é isso, foi mau...
Agradeço a tentativa, mas o fato acontece exatamente com minha aplicação. Se não fosse, as outras aplicações que consomem do mesmo banco teria o mesmo problema. Acredito que errei algo em meu código.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)