Problem with Torastoredproc execution
Problem with Torastoredproc execution
Hi There,
I wonder if someone could please help me with a problem that my colleagues and I are having running a stored procedure using the Torastoredproc component in direct mode ( I think it is dierct mode as we have no Oracle client software installed and the Torastoredproc is using port 1521).
We are using Delphi 2005 with ODAC version 6.25.1.13 (but we also get the same problem with ODAC 6.50).
We have a stored procedure sitting on a Oracle 9.2.0.8 standard edition database. This stored procedure takes 23 parameters, with the last 2 being return parameters.
I can call the stored procedure from an SQL script and it works fine, as well as from a C++ program using Microsoft ADO, so the stored procedure actually runs fine.
The problem that we are getting is that the error "parameter not found" is being returned when we try to execute the stored procedure through the Delphi program using ODAC (direct mode).
The parameter name that is being shown as not being found is the first parameter in the list of 23. From the debugging that I have carried out, the stored procedure is not getting called at all, which would tie in with the error message.
The funny thing is that we can get it working OK through the Delphi program on another Oracle server which is also running Oracle standard edition 9.2.
The only thing that I can think of that is different between the working and non-working Oracle databases is that the non-working scenario is a member of a domain, whereas the working version is just a workgroup.
This is the code for seting up the call to the stored procedure :-
OraStoredProc1.ParamByName('P_OPERATOR').AsString :=RiMaORACLESetNew.MeasOperator;
OraStoredProc1.ParamByName('P_DATE').AsString :=RiMaORACLESetNew.MeasDate;
OraStoredProc1.ParamByName('P_TIME').AsString :=RiMaORACLESetNew.MeasTime;
OraStoredProc1.ParamByName('P_TOOL_SERIAL').AsString :=RiMaORACLESetNew.MeasIdent;
OraStoredProc1.ParamByName('P_TOOL_SIZE').AsFloat :=RiMaORACLESetNew.MeasDiaIn;
OraStoredProc1.ParamByName('P_TOOL_OD').AsFloat :=RiMaORACLESetNew.MeasDiaOut;
OraStoredProc1.ParamByName('P_OVAL_ID').AsFloat :=RiMaORACLESetNew.MeasOvaIn;
OraStoredProc1.ParamByName('P_OVAL_OD').AsFloat :=RiMaORACLESetNew.MeasOvaOut;
OraStoredProc1.ParamByName('P_CONCENTRIC').AsFloat :=RiMaORACLESetNew.MeasConcent;
OraStoredProc1.ParamByName('P_MAX_DIA').AsFloat :=RiMaORACLESetNew.MeasPosMaxDia;
OraStoredProc1.ParamByName('P_TEMP').AsFloat :=RiMaORACLESetNew.MeasTemp;
OraStoredProc1.ParamByName('P_CAL_DATE').AsString :=RiMaORACLESetNew.CalibDate;
OraStoredProc1.ParamByName('P_CAL_TIME').AsString :=RiMaORACLESetNew.CalibTime;
OraStoredProc1.ParamByName('P_CAL_SERIAL').AsString :=RiMaORACLESetNew.CalibIdent;
OraStoredProc1.ParamByName('P_CAL_ID').AsFloat :=RiMaORACLESetNew.CalibDiaIn;
OraStoredProc1.ParamByName('P_CAL_OD').AsFloat :=RiMaORACLESetNew.CalibDiaOut;
OraStoredProc1.ParamByName('P_CAL_OVAL_ID').AsFloat :=RiMaORACLESetNew.CalibOvaIn;
OraStoredProc1.ParamByName('P_CAL_OVAL_OD').AsFloat :=RiMaORACLESetNew.CalibOvaOut;
OraStoredProc1.ParamByName('P_CAL_CONCENTRIC').AsFloat :=RiMaORACLESetNew.CalibConcent;
OraStoredProc1.ParamByName('P_CAL_MAX_DIA').AsFloat :=RiMaORACLESetNew.CalibPosMaxDia;
OraStoredProc1.ParamByName('P_CAL_TEMP').AsFloat :=RiMaORACLESetNew.CalibTemp;
OraStoredProc1.ExecProc;
s1 := OraStoredProc1.ParamByName('P_RETURN_RESULT').AsString;
BodyMakerNo := OraStoredProc1.ParamByName('P_RETURN_MACHINE').AsInteger;
I am thinking that it might be a security issue on the domain installations of Oracle? Any help / pointers would be much appreciated.
Thank you
Clint
I wonder if someone could please help me with a problem that my colleagues and I are having running a stored procedure using the Torastoredproc component in direct mode ( I think it is dierct mode as we have no Oracle client software installed and the Torastoredproc is using port 1521).
We are using Delphi 2005 with ODAC version 6.25.1.13 (but we also get the same problem with ODAC 6.50).
We have a stored procedure sitting on a Oracle 9.2.0.8 standard edition database. This stored procedure takes 23 parameters, with the last 2 being return parameters.
I can call the stored procedure from an SQL script and it works fine, as well as from a C++ program using Microsoft ADO, so the stored procedure actually runs fine.
The problem that we are getting is that the error "parameter not found" is being returned when we try to execute the stored procedure through the Delphi program using ODAC (direct mode).
The parameter name that is being shown as not being found is the first parameter in the list of 23. From the debugging that I have carried out, the stored procedure is not getting called at all, which would tie in with the error message.
The funny thing is that we can get it working OK through the Delphi program on another Oracle server which is also running Oracle standard edition 9.2.
The only thing that I can think of that is different between the working and non-working Oracle databases is that the non-working scenario is a member of a domain, whereas the working version is just a workgroup.
This is the code for seting up the call to the stored procedure :-
OraStoredProc1.ParamByName('P_OPERATOR').AsString :=RiMaORACLESetNew.MeasOperator;
OraStoredProc1.ParamByName('P_DATE').AsString :=RiMaORACLESetNew.MeasDate;
OraStoredProc1.ParamByName('P_TIME').AsString :=RiMaORACLESetNew.MeasTime;
OraStoredProc1.ParamByName('P_TOOL_SERIAL').AsString :=RiMaORACLESetNew.MeasIdent;
OraStoredProc1.ParamByName('P_TOOL_SIZE').AsFloat :=RiMaORACLESetNew.MeasDiaIn;
OraStoredProc1.ParamByName('P_TOOL_OD').AsFloat :=RiMaORACLESetNew.MeasDiaOut;
OraStoredProc1.ParamByName('P_OVAL_ID').AsFloat :=RiMaORACLESetNew.MeasOvaIn;
OraStoredProc1.ParamByName('P_OVAL_OD').AsFloat :=RiMaORACLESetNew.MeasOvaOut;
OraStoredProc1.ParamByName('P_CONCENTRIC').AsFloat :=RiMaORACLESetNew.MeasConcent;
OraStoredProc1.ParamByName('P_MAX_DIA').AsFloat :=RiMaORACLESetNew.MeasPosMaxDia;
OraStoredProc1.ParamByName('P_TEMP').AsFloat :=RiMaORACLESetNew.MeasTemp;
OraStoredProc1.ParamByName('P_CAL_DATE').AsString :=RiMaORACLESetNew.CalibDate;
OraStoredProc1.ParamByName('P_CAL_TIME').AsString :=RiMaORACLESetNew.CalibTime;
OraStoredProc1.ParamByName('P_CAL_SERIAL').AsString :=RiMaORACLESetNew.CalibIdent;
OraStoredProc1.ParamByName('P_CAL_ID').AsFloat :=RiMaORACLESetNew.CalibDiaIn;
OraStoredProc1.ParamByName('P_CAL_OD').AsFloat :=RiMaORACLESetNew.CalibDiaOut;
OraStoredProc1.ParamByName('P_CAL_OVAL_ID').AsFloat :=RiMaORACLESetNew.CalibOvaIn;
OraStoredProc1.ParamByName('P_CAL_OVAL_OD').AsFloat :=RiMaORACLESetNew.CalibOvaOut;
OraStoredProc1.ParamByName('P_CAL_CONCENTRIC').AsFloat :=RiMaORACLESetNew.CalibConcent;
OraStoredProc1.ParamByName('P_CAL_MAX_DIA').AsFloat :=RiMaORACLESetNew.CalibPosMaxDia;
OraStoredProc1.ParamByName('P_CAL_TEMP').AsFloat :=RiMaORACLESetNew.CalibTemp;
OraStoredProc1.ExecProc;
s1 := OraStoredProc1.ParamByName('P_RETURN_RESULT').AsString;
BodyMakerNo := OraStoredProc1.ParamByName('P_RETURN_MACHINE').AsInteger;
I am thinking that it might be a security issue on the domain installations of Oracle? Any help / pointers would be much appreciated.
Thank you
Clint
-
Challenger
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53
I recently had the same problem and I solved it by removing the following bold line in ORA.pas:
procedure TOraStoredProc.SetStoredProcName(Value: string);
begin
if Value FStoredProcName then begin
if not (csReading in ComponentState) then
SQL.Text := '';
FStoredProcName := Trim(Value);
// SQL can be loaded after StoredProcName on reading
if not (csReading in ComponentState) then
if (csDesigning in ComponentState) and (FStoredProcName '') and
(UsedConnection nil) and UsedConnection.Connected
then
PrepareSQL;
end;
end;
procedure TOraStoredProc.SetStoredProcName(Value: string);
begin
if Value FStoredProcName then begin
if not (csReading in ComponentState) then
SQL.Text := '';
FStoredProcName := Trim(Value);
// SQL can be loaded after StoredProcName on reading
if not (csReading in ComponentState) then
if (csDesigning in ComponentState) and (FStoredProcName '') and
(UsedConnection nil) and UsedConnection.Connected
then
PrepareSQL;
end;
end;
Hi cardiodid - thank you for your post. I am not sure if your problem is exactly the same as the one that we are experiencing but I will look into it.
Maybe we are not doing the correct thing, but I think that we set the stored procedure name at design time and do not do anything at runtime to prepare an SQL statement - we just set the parameters in the Torastoredproc component and call the execute method on the component.
I am sure that there is something that I am missing here, as it works ok on one Oracle installation but not another!!
Thanks again.
Maybe we are not doing the correct thing, but I think that we set the stored procedure name at design time and do not do anything at runtime to prepare an SQL statement - we just set the parameters in the Torastoredproc component and call the execute method on the component.
I am sure that there is something that I am missing here, as it works ok on one Oracle installation but not another!!
Thanks again.
-
Challenger
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53
-
OakersMichael
- Posts: 4
- Joined: Fri 27 Jun 2008 07:05
Problem with Torastoredproc execution
Hi there, Hi Clint it's me from OEG
We use different parameter for data base access during design time and
run time because we need same program for different data base locations
and we will load current parameters from a INI-file.
So in *.dfm file there are fixed paramter like this:
//=====================
object OraSession1: TOraSession
Options.Direct = True
Username = 'abc'
Password = 'abc'
Server = '192.168.0.10:1521:xyz'
LoginPrompt = False
HomeName = 'OraHome92'
Left = 40
Top = 24
end
//======================
and the current paramter (ORACLE_...-parameters) will be loaded at run time in following function:
//==================================
function TForm_ODAC_IF.OpenSession: boolean;
begin
result:=true;
OraSession1.ConnectString:=ORACLE_ConnectString;
OraSession1.Password:=ORACLE_Password;
OraSession1.Server:=ORACLE_Server;
OraSession1.UserName:=ORACLE_UserName;
OraStoredProc1.StoredProcName:=ORACLE_StoredProc;
try
OraSession1.connected:=true;
except
MessageDlg('connect function not ok',mtConfirmation, [mbOK], 0);
end;
end;
//==============================
Is this correct and complete or are only the desing values valid?
We use different parameter for data base access during design time and
run time because we need same program for different data base locations
and we will load current parameters from a INI-file.
So in *.dfm file there are fixed paramter like this:
//=====================
object OraSession1: TOraSession
Options.Direct = True
Username = 'abc'
Password = 'abc'
Server = '192.168.0.10:1521:xyz'
LoginPrompt = False
HomeName = 'OraHome92'
Left = 40
Top = 24
end
//======================
and the current paramter (ORACLE_...-parameters) will be loaded at run time in following function:
//==================================
function TForm_ODAC_IF.OpenSession: boolean;
begin
result:=true;
OraSession1.ConnectString:=ORACLE_ConnectString;
OraSession1.Password:=ORACLE_Password;
OraSession1.Server:=ORACLE_Server;
OraSession1.UserName:=ORACLE_UserName;
OraStoredProc1.StoredProcName:=ORACLE_StoredProc;
try
OraSession1.connected:=true;
except
MessageDlg('connect function not ok',mtConfirmation, [mbOK], 0);
end;
end;
//==============================
Is this correct and complete or are only the desing values valid?
-
Challenger
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53
-
OakersMichael
- Posts: 4
- Joined: Fri 27 Jun 2008 07:05
-
OakersMichael
- Posts: 4
- Joined: Fri 27 Jun 2008 07:05
After some test we have localized the problem a little bit more.
It seems the program is ok.
If we open DELPHI for desin time, put in all parameter for the data base
into components as properties and read the data base field names when
we execute params from tOraStoredProc1 and get the current params from database the compiled program will have correct access.
But if we change data base location with same program in run time by
using other location parameters (read from ini file, see above) it
seems the field names from data base are lost.
In both cases we use a database with same structure (fields) only on different location and different location parameters.
Is there property to fix this problem and make the program able to
use data bases on differnt locations without a new compiler run?
Will prepareSQL do this, if it is on the rigth place?
Thanks Again.
It seems the program is ok.
If we open DELPHI for desin time, put in all parameter for the data base
into components as properties and read the data base field names when
we execute params from tOraStoredProc1 and get the current params from database the compiled program will have correct access.
But if we change data base location with same program in run time by
using other location parameters (read from ini file, see above) it
seems the field names from data base are lost.
In both cases we use a database with same structure (fields) only on different location and different location parameters.
Is there property to fix this problem and make the program able to
use data bases on differnt locations without a new compiler run?
Will prepareSQL do this, if it is on the rigth place?
Thanks Again.
-
OakersMichael
- Posts: 4
- Joined: Fri 27 Jun 2008 07:05