Task: connect to IBM Netezza and get Recordset.
I have a next code in Delphi:
procedure TForm1.Button1Click(Sender: TObject);
var
LADOQuery: TADOQuery;
LRecordSet: _Recordset;
LRecCount : Integer;
begin
LADOQuery := TADOQuery.Create(nil);
try
LADOQuery.Prepared := True;
LADOQuery.ConnectionString :=
'Provider=NZOLEDB;Password=password;User ID=admin;Data Source=10.25.11.103;Initial Catalog=test;' +
'Persist Security Info=True;Port=5480;Logging Level=1;';
// LADOQuery.ConnectionString :=
// 'Driver={NetezzaSQL};servername=10.25.11.103;port=5480;database=test;username=admin;password=password;';
LADOQuery.SQL.Text := 'Select * from table_1;';
LADOQuery.Open; { !------- Error under OLEDB -------! }
LRecordSet := LADOQuery.Recordset;
if Assigned(LRecordSet) and (LRecordSet.State = adStateOpen) then
begin
LRecCount := LRecordSet.RecordCount;
ShowMessage(IntToStr(LRecCount));
end;
LADOQuery.Close;
finally
FreeAndNIl(LADOQuery);
end;
end;
There are already drivers for Netezza DB in my system:
- OLEDB(32x and 64x versions) - Product version 7.0.0.4
- ODBC (32x and 64x versions) - Product version 7.0.0.4
When I try use connection settings under OLEDB (NZOLEDB) I get "EOleException error..." otherwise while I use settings uder ODBC (NetezzaSQL) I successfull connect and get correct result.
Question: What can it be reason of error under OLEDB Delphi XE (also tried under XE4)?
---------------------------
Debugger Exception Notification
---------------------------
Project Test.exe raised exception class EOleException with message 'Unspecified error'.
---------------------------
Break Continue Help
---------------------------
PS. Intersting fact: I can connect to Netezza DB and get result via OLEDB driver with same connection string under .NET program:
String sConnectionString = "Provider=NZOLEDB;Password=password;User ID=admin;Data Source=10.25.11.103;Initial Catalog=test;";
System.Data.OleDb.OleDbConnection nzconn = new System.Data.OleDb.OleDbConnection(sConnectionString);
System.Data.OleDb.OleDbCommand nzcomm = new System.Data.OleDb.OleDbCommand();
Thank you in advance!
Task: connect to IBM Netezza and get Recordset.
I have a next code in Delphi:
procedure TForm1.Button1Click(Sender: TObject);
var
LADOQuery: TADOQuery;
LRecordSet: _Recordset;
LRecCount : Integer;
begin
LADOQuery := TADOQuery.Create(nil);
try
LADOQuery.Prepared := True;
LADOQuery.ConnectionString :=
'Provider=NZOLEDB;Password=password;User ID=admin;Data Source=10.25.11.103;Initial Catalog=test;' +
'Persist Security Info=True;Port=5480;Logging Level=1;';
// LADOQuery.ConnectionString :=
// 'Driver={NetezzaSQL};servername=10.25.11.103;port=5480;database=test;username=admin;password=password;';
LADOQuery.SQL.Text := 'Select * from table_1;';
LADOQuery.Open; { !------- Error under OLEDB -------! }
LRecordSet := LADOQuery.Recordset;
if Assigned(LRecordSet) and (LRecordSet.State = adStateOpen) then
begin
LRecCount := LRecordSet.RecordCount;
ShowMessage(IntToStr(LRecCount));
end;
LADOQuery.Close;
finally
FreeAndNIl(LADOQuery);
end;
end;
There are already drivers for Netezza DB in my system:
- OLEDB(32x and 64x versions) - Product version 7.0.0.4
- ODBC (32x and 64x versions) - Product version 7.0.0.4
When I try use connection settings under OLEDB (NZOLEDB) I get "EOleException error..." otherwise while I use settings uder ODBC (NetezzaSQL) I successfull connect and get correct result.
Question: What can it be reason of error under OLEDB Delphi XE (also tried under XE4)?
---------------------------
Debugger Exception Notification
---------------------------
Project Test.exe raised exception class EOleException with message 'Unspecified error'.
---------------------------
Break Continue Help
---------------------------
PS. Intersting fact: I can connect to Netezza DB and get result via OLEDB driver with same connection string under .NET program:
String sConnectionString = "Provider=NZOLEDB;Password=password;User ID=admin;Data Source=10.25.11.103;Initial Catalog=test;";
System.Data.OleDb.OleDbConnection nzconn = new System.Data.OleDb.OleDbConnection(sConnectionString);
System.Data.OleDb.OleDbCommand nzcomm = new System.Data.OleDb.OleDbCommand();
Thank you in advance!
0 commentaires:
Enregistrer un commentaire