Direct mode and dedicated connection

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
jajimenez
Posts: 4
Joined: Wed 21 Jan 2015 08:30

Direct mode and dedicated connection

Post by jajimenez » Mon 30 Jul 2018 08:57

I am using dbexpress in direct mode. Is it possible to establish a dedicated connection?

I have not been able to find anything about it in the documentation or forum.

Thanks in advance.

MaximG
Devart Team
Posts: 1138
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode and dedicated connection

Post by MaximG » Mon 30 Jul 2018 12:33

You can use the description of the TNS alias when working in Direct Mode in the same way as in OCI Mode. To do this, assign the required value to the DataBase property :

Code: Select all

 ...
  SQLConnection.DriverName := 'DevartOracleDirect';
  SQLConnection.Params.Values['DataBase'] := '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<your HOST>)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=<your SERVICE_NAME>)))';
  SQLConnection.Params.Values['User_Name'] := 'scott';
  SQLConnection.Params.Values['Password'] := 'tiger';
  SQLConnection.Connected := True;
  ...

jajimenez
Posts: 4
Joined: Wed 21 Jan 2015 08:30

Re: Direct mode and dedicated connection

Post by jajimenez » Wed 01 Aug 2018 08:24

Thanks for your help, but it didn't work.

I have tried and I can connect with parameters in TNS style, but the connection is still shared. If it helps, this is my code:

SQLConnection.Params.Values['DataBase'] := '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<host>)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=<service name>)))';

But when the program connects to Oracle, what Oracle gets is this:

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<host>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=<service ame>)(CID=(PROGRAM=<exe name>)(HOST=<my PC's name>)(USER=<my Windows username>))))

It seems that, no matter what the value for SERVER is, it is always omitted in the connection.

Any other idea to try?

MaximG
Devart Team
Posts: 1138
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode and dedicated connection

Post by MaximG » Fri 03 Aug 2018 13:45

We will investigate the described issue and let you know the results shortly

jajimenez
Posts: 4
Joined: Wed 21 Jan 2015 08:30

Re: Direct mode and dedicated connection

Post by jajimenez » Fri 03 Aug 2018 15:20

Thank you for your attention.

If it helps: I have checked both Delphi 7 and XE 10.2 using the latest version of your DLLs ( 6.10.15.0 )

MaximG
Devart Team
Posts: 1138
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode and dedicated connection

Post by MaximG » Mon 06 Aug 2018 13:54

We tested the operation of our driver according to your description and found no problems. In our tests, we used Oracle server 12.2.0.1.0, as well as the latest version of our driver. The connection mode was checked by requesting the v$session view :

Code: Select all

 SELECT SERVER FROM v$session WHERE SCHEMANAME='SCOTT' 
When connected according to the sample above, this query returns the "DEDICATED" value. Please specify the Oracle server version you are using. What value will the query return to the v$session view when performing similar actions in your environment?

jajimenez
Posts: 4
Joined: Wed 21 Jan 2015 08:30

Re: Direct mode and dedicated connection

Post by jajimenez » Tue 28 Aug 2018 09:18

Sorry for the delay. Our DBA was on holiday and I couldn't get help until yesterday (my user didn't have enough privileges to access v$session)

Our Oracle version is the same as yours, oracle 12.c release 2.

I have checked the query you told me and the result is always 'SHARED' (In SQLDeveloper connections I get 'DEDICATED' as expected)

MaximG
Devart Team
Posts: 1138
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode and dedicated connection

Post by MaximG » Tue 11 Sep 2018 09:03

We again tested the possibility of using the DEDICATED connection with DevartOracleDirect using the following console application:

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, Data.DB, Data.SqlExpr,
  DBXDevartOracle;

var
  SQLConnection: TSQLConnection;
begin
  SQLConnection := TSQLConnection.Create(nil);
  try
    SQLConnection.ConnectionName :='Devart Oracle Direct';
    SQLConnection.DriverName := 'DevartOracleDirect';
    SQLConnection.Params.Values['User_Name'] := 'MaximG';
    SQLConnection.Params.Values['Password'] := 'MaximG Password';
    SQLConnection.Params.Values['Database'] := '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle12c.testdata)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orclpdb.env)))';
    SQLConnection.Connected := True;
    ReadLn;
  finally
    SQLConnection.Free;
  end;
end.


Then we got the query result (SELECT SID, SERVER, SCHEMANAME FROM v$session WHERE SCHEMANAME='MAXIMG' And PROGRAM='Project1.exe') shown in the screenshot :
Image
Try performing the same actions in your test environment. Make sure again that in the test application and when using any third-party utilities, you connect with absolutely identical connection parameters.

Post Reply