Occasional memmory leak in Unicode=true mode
Occasional memmory leak in Unicode=true mode
We are using OraDirect .NET 3.50.10 in our .Net application and Oracle 9.2.0.4. In application we use a lot of OracleCommands with insert SQL statements like:
INSERT INTO ptn_events_and_phone_lines
(ptneapl_id, ptneapl_event_id)
values
(ptn_events_and_phone_lines_seq.NEXTVAL, :ptneapl_event_id)
The parameters list was created automatically by ODAC internal wizard. Every parameters was by VarChar type. And all works fine before we set Unicode=true. We starts to receive a lot of strange exceptions from Oracle that some of requered parameters was not sended or sended with null value. After that happened I change all parameters types to there real types, e.g. from Varchar to Integer and Number. This problem was solved, but found another one. Sometimes, on some dedicated computers in parameters of Varchar type was inserted with correct entered info some garbage from memmory. The single suspicious place is in the Varchar parameters. In ODAC wizard there is possibile to set parameter length. May be I must set Varchar parameter length manually for every parameter of Varchar type? And what this parameter means? If in DB I am using to store string Varchar2(1000) and in .Net application string, which length I must set in parameter. 1000? or 1000/3? or 1000*3?
INSERT INTO ptn_events_and_phone_lines
(ptneapl_id, ptneapl_event_id)
values
(ptn_events_and_phone_lines_seq.NEXTVAL, :ptneapl_event_id)
The parameters list was created automatically by ODAC internal wizard. Every parameters was by VarChar type. And all works fine before we set Unicode=true. We starts to receive a lot of strange exceptions from Oracle that some of requered parameters was not sended or sended with null value. After that happened I change all parameters types to there real types, e.g. from Varchar to Integer and Number. This problem was solved, but found another one. Sometimes, on some dedicated computers in parameters of Varchar type was inserted with correct entered info some garbage from memmory. The single suspicious place is in the Varchar parameters. In ODAC wizard there is possibile to set parameter length. May be I must set Varchar parameter length manually for every parameter of Varchar type? And what this parameter means? If in DB I am using to store string Varchar2(1000) and in .Net application string, which length I must set in parameter. 1000? or 1000/3? or 1000*3?
Odac I meant Oracle .Net direct. The problem is very hard reprodusable. It happens only on 2 computers. Sending a test application do not help. The problem starts when we set Unicode = true. The question was have I set manually parameters types and Varchar length in OracleCommand?
E.g. i have DB table PTN_EVENTS as :
CREATE TABLE PTN_EVENTS
(
PTNE_ID INTEGER,
PTNE_NAME VARCHAR2(400 BYTE),
PTNE_DESCRIPTION VARCHAR2(1000 BYTE),
PTNE_STATUS_ID INTEGER NOT NULL,
PTNE_START_DATE DATE,
)
And to insert data in this table in .Net application I am using OracleCommand with CommandText:
INSERT INTO PTN_EVENTS (
PTNE_ID, PTNE_NAME, PTNE_DESCRIPTION,
PTNE_STATUS_ID, PTNE_START_DATE)
VALUES (
:PTNE_ID, :PTNE_NAME, :PTNE_DESCRIPTION,
:PTNE_STATUS_ID, :PTNE_START_DATE)
The automatically generated by OracleCommand Editor paramenters will be by type Varchar with length 0 regards of its real types. The question is have I change parameters type manually? And in case Varchar fields (in my example PTNE_NAME, PTNE_DESCRIPTION) what length i msut set? 400 and 1000 correspondently?
E.g. i have DB table PTN_EVENTS as :
CREATE TABLE PTN_EVENTS
(
PTNE_ID INTEGER,
PTNE_NAME VARCHAR2(400 BYTE),
PTNE_DESCRIPTION VARCHAR2(1000 BYTE),
PTNE_STATUS_ID INTEGER NOT NULL,
PTNE_START_DATE DATE,
)
And to insert data in this table in .Net application I am using OracleCommand with CommandText:
INSERT INTO PTN_EVENTS (
PTNE_ID, PTNE_NAME, PTNE_DESCRIPTION,
PTNE_STATUS_ID, PTNE_START_DATE)
VALUES (
:PTNE_ID, :PTNE_NAME, :PTNE_DESCRIPTION,
:PTNE_STATUS_ID, :PTNE_START_DATE)
The automatically generated by OracleCommand Editor paramenters will be by type Varchar with length 0 regards of its real types. The question is have I change parameters type manually? And in case Varchar fields (in my example PTNE_NAME, PTNE_DESCRIPTION) what length i msut set? 400 and 1000 correspondently?
Strings are passed to Oracle server in UTF16 format when you use Unicode=true option in OraDirect .NET. Oracle server converts them to UTF8 in your case. You have to assign OracleParameter.Size property with the maximum number of characters in string values that you pass through parameter. The zero value is used to define 4000 characters buffer.
What is the exact text (or error code) of error messages that you received?
What is the exact text (or error code) of error messages that you received?