Delphi 2010 中的 dbExpress 错误
下面的代码在 Delphi 2007 中有效,但在 Delphi 2010 中却给出了这个错误:
---------------------------
Error
---------------------------
Cannot load oci.dll library (error code 127).
The oci.dll library may be missing from the system path
or you may have an incompatible version of the
library installed.
---------------------------
OK Details >>
---------------------------
当我将“connected”设置为“true”时,引发异常。
我尝试将“oci.dll”的副本放在与 .exe 文件相同的文件夹中,但收到相同的消息。
当使用表单设计器和可见的 TSQLConnection 组件时,我也会收到此消息。
有什么想法吗?
function TDBExpressConnector.GetConnection(username, password, servername: string) : TSQLConnection;
begin
//take a username, password, and server
//return a connected TSQLConnection
try
FSqlDB := TSQLConnection.Create(nil);
with FSqlDB do begin
Connected := False;
DriverName := 'Oracle';
GetDriverFunc := 'getSQLDriverORACLE';
KeepConnection := True;
LibraryName := 'dbxora30.dll';
ConnectionName := 'OracleConnection';;
Params.Clear;
Params.Add('DriverName=Oracle');
Params.Add('DataBase=' + servername);
Params.Add('User_Name=' + username);
Params.Add('Password=' + password);
Params.Add('RowsetSize=20');
Params.Add('BlobSize=-1');
Params.Add('ErrorResourceFile=');
Params.Add('LocaleCode=0000');
Params.Add('Oracle TransIsolation=ReadCommited');
Params.Add('OS Authentication=False');
Params.Add('Multiple Transaction=False');
Params.Add('Trim Char=False');
Params.Add('Decimal Separator=.');
LoginPrompt := False;
Connected := True;
end;
Result := FSqlDB;
except on e:Exception do
raise;
end; //try-except
end;
The below code works in Delphi 2007, but it gives me this error in Delphi 2010:
---------------------------
Error
---------------------------
Cannot load oci.dll library (error code 127).
The oci.dll library may be missing from the system path
or you may have an incompatible version of the
library installed.
---------------------------
OK Details >>
---------------------------
The exception is raised when I set "connected" to "true".
I have tried placing a copy of "oci.dll" in the same folder as the .exe file, but I get the same message.
I also get this message when using the form designer and a visible TSQLConnection component.
Any thoughts?
function TDBExpressConnector.GetConnection(username, password, servername: string) : TSQLConnection;
begin
//take a username, password, and server
//return a connected TSQLConnection
try
FSqlDB := TSQLConnection.Create(nil);
with FSqlDB do begin
Connected := False;
DriverName := 'Oracle';
GetDriverFunc := 'getSQLDriverORACLE';
KeepConnection := True;
LibraryName := 'dbxora30.dll';
ConnectionName := 'OracleConnection';;
Params.Clear;
Params.Add('DriverName=Oracle');
Params.Add('DataBase=' + servername);
Params.Add('User_Name=' + username);
Params.Add('Password=' + password);
Params.Add('RowsetSize=20');
Params.Add('BlobSize=-1');
Params.Add('ErrorResourceFile=');
Params.Add('LocaleCode=0000');
Params.Add('Oracle TransIsolation=ReadCommited');
Params.Add('OS Authentication=False');
Params.Add('Multiple Transaction=False');
Params.Add('Trim Char=False');
Params.Add('Decimal Separator=.');
LoginPrompt := False;
Connected := True;
end;
Result := FSqlDB;
except on e:Exception do
raise;
end; //try-except
end;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Delphi 2010 中,Oracle 的 dbExpress 驱动程序是 dbxora.dll。命名连接中的库名称为 dbxora30.dll。很有可能它可以使用正确的名称!
In Delphi 2010 the dbExpress driver for Oracle is dbxora.dll. The libraryname in your named connection says dbxora30.dll. Good chance it will work with the correct name!
请参阅此处的问题和修复: 我的博客
只需将您的 dll 替换为我在帖子中提到的 dll 即可。您应该在同一目录中找到它。
See the problem and the fix here: My Blog
Just substitute your dll for the one I mention in my post. You should find it in the same directory.