Page 1 of 1

Direct = True always required?

Posted: Thu 19 Apr 2012 11:09
by robcube
I was trying to connect via Oracle Standard Edition and it seems the only way to connect is to use Direct = True to go with the SID/Service Name. What do I need to do to make the connection string as simple as possible, as shown in the first C# example at:

http://www.devart.com/dotconnect/oracle ... tring.html

Am trying to use the ExecuteArray, and read that ExecuteArray with Direct = True don't work all that well.

Must be a Oracle server configuration issue to make the above work?

Thanks,
-rob

Posted: Mon 23 Apr 2012 14:21
by Pinturiccio
You can use two modes when establish a connection:
1. OCI mode - requires Oracle Client installed on the deployment computer. The minimal set off the connection string parameters that you should set for establishing a connection:

Code: Select all

OracleConnection conn = new OracleConnection();
conn.Server = "***"; 
conn.UserId = "***";
conn.Password = "***";
conn.Open();
2. Direct mode - does not require Oracle Client installed on the deployment computer. The minimal set off the connection string parameters that you should set for establishing a connection:

Code: Select all

OracleConnection conn = new OracleConnection();
conn.Server = "***"; 
conn.UserId = "***";
conn.Password = "***";
conn.Direct = true;
conn.Sid = "***"; 
conn.Port = 1521; //If your server uses 1521 port, this is the default value, used by dotConnect for Oracle and you don't need to specify conn.Port = 1521;
conn.Open();
The ExecuteArray method is supported in direct mode. Information in the documentation is a bit outdated. We will update the documentation about the ExecuteArray method support in Direct mode soon.

Posted: Mon 23 Apr 2012 19:52
by robcube
Thanks for your help! Passed that point. Now ExecuteArray just sticks there, it doesn't move anywhere beyond that point, no errors or any feedback. Here's the code used:

Code: Select all

private void BuildLocationOracleArray(OracleCommand cmd, List list)
{
            cmd.CommandText =
                @"INSERT INTO ""StagingTable"" VALUES(:id, :address, :cityId, :dateCreated, :dateModified)";

            cmd.Parameters.Add("id", OracleDbType.Integer);
            cmd.Parameters.Add("address", OracleDbType.VarChar, 200);
            cmd.Parameters.Add("cityId", OracleDbType.Integer);
            cmd.Parameters.Add("dateCreated", OracleDbType.Date);
            cmd.Parameters.Add("dateModified", OracleDbType.Date);

            cmd.Parameters["id"].Value = list.Select(item => item.Id).ToArray();
            cmd.Parameters["address"].Value = list.Select(item => item.Address).ToArray();
            cmd.Parameters["cityId"].Value = list.Select(item => item.CityId).ToArray();
            cmd.Parameters["dateCreated"].Value = list.Select(item => item.DateCreated).ToArray();
            cmd.Parameters["dateModified"].Value = list.Select(item => item.DateModified).ToArray();

            cmd.ExecuteArray(list.Count); // code stops here when hitting breakpoint, would not continue.
            cmd.Dispose();
}

Posted: Thu 26 Apr 2012 11:50
by Pinturiccio
Could you please specify the dotConnect for Oracle version? You can check it by selecting About dotConnect for Oracle from the Oracle submenu of the Tools menu in Visual Studio. You will see the dialog box displaying the version and edition of dotConnect for Oracle.

Re: Direct = True always required?

Posted: Tue 01 May 2012 16:28
by robcube
6.80.350

Re: Direct = True always required?

Posted: Mon 14 May 2012 12:56
by Pinturiccio
Please send us your DDL script for creating the table "StagingTable". We would also appreciate a small test project.

Please, also specify the Oracle server version.