Application freeze on DB command execution when .Net DLL is accessed from Delphi EXE.
Application freeze on DB command execution when .Net DLL is accessed from Delphi EXE.
Hi,
The problem is that the application freeze when accessed from Delphi EXE. The application is a .Net DLL (VS2005). Its code is using ODAC for .Net version 3.50.11.0.
The .Net DLL is exposed through COM. The Delphi EXE is using COM to invoke the .Net DLL’s functionality.
When the .Net DLL is accessed using .Net EXE (not through COM) then all is well.
The freeze is on the line: reader = command.ExecuteReader();
What can be done to make it work when accessed from Delphi EXE?
Here is part of the code of the .Net class (packaged as DLL).
(The DLL is signed and COM-registered. The DLL is also registered in the GAC. A .Tlb file was produced and used by the Delphi EXE.)
[Guid("6510907A-F959-4517-B677-1FBC9F4603E2")]
[ComVisible(true)]
public class EntryPoint : IPSR_Excel
{
public void NewReport_1 ()
{
CoreLab.Oracle.OracleConnection conn = new CoreLab.Oracle.OracleConnection();
conn.ConnectionString = "User Id=;Password=;Server=;Direct=True;Sid=;";
conn.Open();
CoreLab.Oracle.OracleCommand command = new CoreLab.Oracle.OracleCommand();
command.CommandType = System.Data.CommandType.Text;
command.CommandText = "select sysdate from dual";
command.Connection = conn;
System.Windows.Forms.MessageBox.Show("Query Before");
CoreLab.Oracle.OracleDataReader reader;
reader = command.ExecuteReader();
System.Windows.Forms.MessageBox.Show("Query After");
if (reader.HasRows)
{ // there is a record.
reader.Read();
System.Windows.Forms.MessageBox.Show("Sysdate = " + reader.GetDateTime(0).ToString());
}
conn.Close();
}
Thanks
Eitan
The problem is that the application freeze when accessed from Delphi EXE. The application is a .Net DLL (VS2005). Its code is using ODAC for .Net version 3.50.11.0.
The .Net DLL is exposed through COM. The Delphi EXE is using COM to invoke the .Net DLL’s functionality.
When the .Net DLL is accessed using .Net EXE (not through COM) then all is well.
The freeze is on the line: reader = command.ExecuteReader();
What can be done to make it work when accessed from Delphi EXE?
Here is part of the code of the .Net class (packaged as DLL).
(The DLL is signed and COM-registered. The DLL is also registered in the GAC. A .Tlb file was produced and used by the Delphi EXE.)
[Guid("6510907A-F959-4517-B677-1FBC9F4603E2")]
[ComVisible(true)]
public class EntryPoint : IPSR_Excel
{
public void NewReport_1 ()
{
CoreLab.Oracle.OracleConnection conn = new CoreLab.Oracle.OracleConnection();
conn.ConnectionString = "User Id=;Password=;Server=;Direct=True;Sid=;";
conn.Open();
CoreLab.Oracle.OracleCommand command = new CoreLab.Oracle.OracleCommand();
command.CommandType = System.Data.CommandType.Text;
command.CommandText = "select sysdate from dual";
command.Connection = conn;
System.Windows.Forms.MessageBox.Show("Query Before");
CoreLab.Oracle.OracleDataReader reader;
reader = command.ExecuteReader();
System.Windows.Forms.MessageBox.Show("Query After");
if (reader.HasRows)
{ // there is a record.
reader.Read();
System.Windows.Forms.MessageBox.Show("Sysdate = " + reader.GetDateTime(0).ToString());
}
conn.Close();
}
Thanks
Eitan
Hi,
Thanks for the response.
We are experimenting with the trial version.
I read the help page (ms-help://CoreLab.Oracle/OraDirect/Licensing.html).
Found/did the following:
1. The file licenses.licx already exists.
2. The file licenses.licx contains: CoreLab.Oracle.OracleConnection, CoreLab.Oracle, Version=3.50.11.0, Culture=neutral, PublicKeyToken=09af7300eec23701
3. The file licenses.licx is part of the dll project (under Properties) and its build action is “Embedded Resource”
4. Followed the instructions in section “Class Libraries Support”.
But the behavior is the same. The application freezes on the line: reader = command.ExecuteReader();
Eitan
Thanks for the response.
We are experimenting with the trial version.
I read the help page (ms-help://CoreLab.Oracle/OraDirect/Licensing.html).
Found/did the following:
1. The file licenses.licx already exists.
2. The file licenses.licx contains: CoreLab.Oracle.OracleConnection, CoreLab.Oracle, Version=3.50.11.0, Culture=neutral, PublicKeyToken=09af7300eec23701
3. The file licenses.licx is part of the dll project (under Properties) and its build action is “Embedded Resource”
4. Followed the instructions in section “Class Libraries Support”.
But the behavior is the same. The application freezes on the line: reader = command.ExecuteReader();
Eitan