Page 1 of 1
Connect as SYSDBA or SYSOPER
Posted: 26.07.2020, 08:09
by piotr.b.brzeski
Hey,
Does anybody know how to connect to oracle db as SYDBA or SYSOPER?
Re: Connect as SYSDBA or SYSOPER
Posted: 28.07.2020, 10:30
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?
Re: Connect as SYSDBA or SYSOPER
Posted: 29.08.2020, 09:03
by piotr.b.brzeski
Sorry, how to connect on SYS schema as SYSDBA role with ZEOS without changing Zeos source?
Re: Connect as SYSDBA or SYSOPER
Posted: 29.08.2020, 13:50
by piotr.b.brzeski
... I talk about oracle database connection, no Firebird
Re: Connect as SYSDBA or SYSOPER
Posted: 31.08.2020, 09:53
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:
Best regards,
Jan
Re: Connect as SYSDBA or SYSOPER
Posted: 15.09.2020, 17:55
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...
Re: Connect as SYSDBA or SYSOPER
Posted: 04.07.2021, 13:00
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?)
Re: Connect as SYSDBA or SYSOPER
Posted: 04.07.2021, 13:09
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;
Re: Connect as SYSDBA or SYSOPER
Posted: 04.07.2021, 14:27
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;
Re: Connect as SYSDBA or SYSOPER
Posted: 05.07.2021, 07:55
by piotr.b.brzeski
Tried this, but it doesn't work, it's still the ORA-28009 error.
Re: Connect as SYSDBA or SYSOPER
Posted: 05.07.2021, 11:01
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.
Re: Connect as SYSDBA or SYSOPER
Posted: 05.07.2021, 14:02
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
Re: Connect as SYSDBA or SYSOPER
Posted: 05.07.2021, 16:04
by marsupilami
Sorry - but we don't support Code Typhoon. It is a moving target. We only support Delphi and Lazarus.
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.
Good to know.
Best regards,
Jan