Direct = True always required?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
robcube
Posts: 7
Joined: Thu 19 Apr 2012 11:00

Direct = True always required?

Post by robcube » Thu 19 Apr 2012 11:09

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

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Mon 23 Apr 2012 14:21

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.

robcube
Posts: 7
Joined: Thu 19 Apr 2012 11:00

Post by robcube » Mon 23 Apr 2012 19:52

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();
}

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Thu 26 Apr 2012 11:50

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.

robcube
Posts: 7
Joined: Thu 19 Apr 2012 11:00

Re: Direct = True always required?

Post by robcube » Tue 01 May 2012 16:28

6.80.350

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Direct = True always required?

Post by Pinturiccio » Mon 14 May 2012 12:56

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.

Post Reply