Connect as SYSDBA or SYSOPER

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
piotr.b.brzeski
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 20.07.2020, 07:01

Connect as SYSDBA or SYSOPER

Post by piotr.b.brzeski »

Hey,

Does anybody know how to connect to oracle db as SYDBA or SYSOPER?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Connect as SYSDBA or SYSOPER

Post by marsupilami »

Hello, usually it is just setting UserName to "SYSDBA" and Password to to the password assigned to SYSDBA. What error message do you get?
piotr.b.brzeski
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 20.07.2020, 07:01

Re: Connect as SYSDBA or SYSOPER

Post by piotr.b.brzeski »

Sorry, how to connect on SYS schema as SYSDBA role with ZEOS without changing Zeos source?
piotr.b.brzeski
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 20.07.2020, 07:01

Re: Connect as SYSDBA or SYSOPER

Post by piotr.b.brzeski »

... I talk about oracle database connection, no Firebird
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Connect as SYSDBA or SYSOPER

Post by marsupilami »

Hello Piotr,

this is - more or less - what I do on our test server:

Code: Select all

ZConnection.Protocol := 'oracle';
ZConnection.Host := 'localhost';
ZConnection.Database := '';
ZConnection.Port := 0; // meaning use the default port
ZConnection.Username := 'SYSTEM';
ZConnection.Password := '********' // insert your password here
ZConnection.ClientCodepage := 'UTF8';
This usually gets me connected.

If you want to set the default schema to be SYS, the following might work:

Code: Select all

ZConnection.Catalog := 'SYS';
Best regards,

Jan
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Connect as SYSDBA or SYSOPER

Post by EgonHugeist »

Honestly (lack of knowledge) we'd start from the premisse the username and it's grand options is doing the job. After reading viewtopic.php?f=50&t=125819 the sentence is clear.. Patch done https://sourceforge.net/p/zeoslib/code-0/6825/ and https://sourceforge.net/p/zeoslib/code-0/6824/ it should do the job. Patch will be merged to 7.2 next days...
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
piotr.b.brzeski
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 20.07.2020, 07:01

Re: Connect as SYSDBA or SYSOPER

Post by piotr.b.brzeski »

You don't understand how to switch to SYSDBA or SYSOPER mode during connection, I mean something like TZConnection.Properties.Values ​​['OCIAuthenticateMode = OCI_SYSDBA']; or TZConnection.AuthenticationMode: = OCI_SYSDBA or how? Where should I put it in the code, because I don't see anything like this anywhere in the TZConnection and nobody on the internet describes it, so either it's that simple or I don't know ...

(How do You connect as SYSDBA / SYSOPER to Oracle Database in Your code?)
piotr.b.brzeski
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 20.07.2020, 07:01

Re: Connect as SYSDBA or SYSOPER

Post by piotr.b.brzeski »

... Or else I am asking for the simplest possible example codes that will connect to the SYS schema on the Oracle database.


what should be added in the following?
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex]:= TZConnection.Create(nil);
  MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].Name:=LoginForm.UserEdit.Text+IntToStr(MenuGlowne.gConnectionIndex)+'Connection';
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].AutoCommit:= false;
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].ClientCodepage:= 'UTF8';
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].ControlsCodePage:= cCP_UTF8;
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].Protocol:= 'oracle';
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].TransactIsolationLevel:= tiReadCommitted;
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].UseMetadata:= false;

MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].User:= LoginForm.UserEdit.Text;
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].Password:= LoginForm.PasswEdit.Text;
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].Database:= LoginForm.SidEdit.Text;
MenuGlowne.ConnectionsTable[MenuGlowne.gConnectionIndex].Connected:= true; 
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Connect as SYSDBA or SYSOPER

Post by marsupilami »

Authentication mode is set by the OCIAuthenticateMode property. It hast to be set before the connection to the database is established. OCIAuthenticateMode maps to the mode parameter of OCISessionBegin. The parameter needs to be set as an integer value because it is a field of flags. Possible modes and their values:
  • OCI_DEFAULT = 0
  • OCI_MIGRATE = 1
  • OCI_SYSDBA = 2
  • OCI_SYSOPER = 4
  • OCI_PRELIM_AUTH = 8
So in your case the code should look somewhat similar to this:

Code: Select all

ZConnection.Properties.Add('OCIAuthenticateMode = 2');
// ... some other code ...
ZConnection.Connect;
piotr.b.brzeski
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 20.07.2020, 07:01

Re: Connect as SYSDBA or SYSOPER

Post by piotr.b.brzeski »

Tried this, but it doesn't work, it's still the ORA-28009 error.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Connect as SYSDBA or SYSOPER

Post by marsupilami »

There was a mistake on my side. Delphi TStrings doesn't like spaces in its key-value implementations. So the source code should look something like this:

Code: Select all

ZConnection.Properties.Add('OCIAuthenticateMode=2');
// ... some other code ...
ZConnection.Connect;
Please note that there are no spaces. This works for me in my sample application.
piotr.b.brzeski
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 20.07.2020, 07:01

Re: Connect as SYSDBA or SYSOPER

Post by piotr.b.brzeski »

btw, besides, I didn't have the right version, after installing CodeTyphon with ZESO 7.5.1 it worked, I didn't take into account that only in version 7.3.0 these changes came in, and I had version 7.2

OK, now is good, many thanks
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Connect as SYSDBA or SYSOPER

Post by marsupilami »

piotr.b.brzeski wrote: 05.07.2021, 14:02 after installing CodeTyphon
Sorry - but we don't support Code Typhoon. It is a moving target. We only support Delphi and Lazarus.
piotr.b.brzeski wrote: 05.07.2021, 14:02 with ZESO 7.5.1
There never was a Zeos version 7.5. Never ever.
piotr.b.brzeski wrote: 05.07.2021, 14:02 I didn't take into account that only in version 7.3.0 these changes came in, and I had version 7.2
Zeos 7.2 from SVN has the necessary changes.
piotr.b.brzeski wrote: 05.07.2021, 14:02 OK, now is good, many thanks
Good to know.

Best regards,

Jan
Post Reply