How to work with Gitora via IDE PL\SQL Developer?

Good day.

First of all I’d like to express gratitude to creators of the Gitora. It’s very necessary for oracle database developers.

Please be kindly to clarify to me one aspect of the Gitora.

In our company we used to develop pl sql scripts in PL\SQl Developer IDE. But we can’t modify scripts which checked out by Gitora. If I try to compile modified procedure in PL\SQL Developer, I faced a error message “ORA-20001: Procedure XXX is being managed by Version Control. Log in to version conatrol management system before modifying it.”.

The question is what should I do to make PL\SQl Developer IDE worrk with Gitora?

Hi Alisher,

Thank you for using Gitora and bringing sanity to PL/SQL. :slight_smile:

You can use PL/SQL API’s to connect to Gitora from any PL/SQL development tool. There is a nice tutorial at . I recommend you to read the whole document before using Gitora but here is the relevant excerpt regarding the PL/SQL API’s to log in to Gitora from any PL/SQL editor:

Editing a Database Object Managed by Gitora

Developers may continue using their favorite PL/SQL editor to edit database objects managed by Gitora. Since Gitora is implemented at the database level, it works with any editor.

Once a database object is part of a repository, Gitora will only allow changes to it from database sessions which have a logged in Gitora user and if the database object is not already checked out by another user.

Gitora has an API package called api_gitora.

The API’s in api_gitora are as follows:

login(in_user_cd varchar2, in_password_tx varchar2) :signs in to Gitora with a valid Gitora user name and password

logout;signs out of Gitora

checkOutDBObject(in_schema_cd varchar2, in_type_cd varchar2, in_name_tx varchar2); Locks the specified database object for the logged in Gitora user.

releaseDBObject(in_schema_cd varchar2, in_type_cd varchar2, in_name_tx varchar2); Releases the lock on the specified database object owned by the logged in Gitora user.

addDBObject(in_schema_cd varchar2, in_type_cd varchar2, in_name_tx varchar2, in_repoName_tx varchar2); Adds a database object to a Gitora repository.

There are four more API’s in api_gitora that are used by Gitora internally to manage database objects.Use the TYPE_FUNCTION, TYPE_PACKAGE, TYPE_PROCEDURE, TYPE_SYNONYM, TYPE_TRIGGER, TYPE_VIEW constants in the api_gitora package as input values to the in_type_cd parameter in the API’s.

Use the checkOutDbObject API to check out a database object. During a save, Gitora automatically attempts to check out a database object if the database session has a logged in Gitora user. If the object is already checked out by another developer, Gitora prevents the save with an appropriate error message. Developers may also use the Gitora Code Manager and check out a database object from the navigation tree by right clicking to it and selecting the check out menu item from the pop up menu.

So to log in to Gitora from any PL/SQL editor all you need to do is to execute:

api_gitora.login(:username, :password);

After you execute this line of code, the database session the code is executed in will be logged in to Gitora and Gitora will allow you to edit the checked out code units.

Please note that, several PL/SQL Editors open new database connections for each window they open. So, if you are not careful, you might be signed in, in a window but then still receive an error in the other window. The login procedure only signs you in to Gitora in the database session it is executed in.

Hope this helps.

Kind Regards,

I’m trying to use Gitora with PL/SQL Developer by Allroundautomations.

I can’t edit a package in a easy way.
When I edit the package, from the program window is not possible do calls via the api_gitora.
Only if I open a new window (sql window) I can do call via api_gitora.

Is theare a workaround?

Best regards,

Hi John,

To edit a package which is managed by Gitora, you should be logged in to Gitora from the database session you opened to edit the package.

You should use api_gitora.login procedure to sign in to Gitora.

You only need to do this once per database session. Then Gitora will recognize you and allow you to edit any packages you already check out. If you edit a package and try to save it, Gitora will automatically attempt the check out this package for you (if it’s not check out by you already). If the package is available (i.e. not check out by anyone else) your save will succeed, otherwise it will not.

Doing this manually is not much work. you should just execute one line of code when you open a new database connection to sign in to Gitora. But some tools allow automatic execution of scripts when a new database session is opened. So you can try to execute something like api_gitora.login(‘username1’,‘passsword1’) automatically whenever your tool opens a new session. I don’t know if such an automation is possible in PL/SQL developer.

Hope this helps.

Kind Regards,

This one big problem with Gitora and PLSQL Developer. Only way how you can use it is to switch to Single Session mode. But this mode has a lot of restrictions. For example you can not use debugging and others very important thinks for developers.
In other modes (Dual or Multi Session) you can not open new window with the same session like program (compiler) window, where you are compiling.
I was searching how to run the SQL command for the same session like compiler window in PLSQL but it looks like it is not possible.
So from this point of view it is useless and we can’t use it :frowning :frowning:

If there is a way please respond.

Thank You

Hi all PL/SQL Developer users,

There are several ways to use Gitora with PL/SQL developer in dual or multi-session mode.

  1. In the PLSQL Developer installation directory you can use a AfterConnect.sql script. That is executed for every connection you make to the database.
    Put something like this in it:


  1. create a menu button that executes a script with api_gitora.login.
    This will execute the script in the current session/window.
    You can create a menu item like this:
  • Go to menu Tools - Configure tools
  • in the dialog click on the right side button ‘New tool’
  • On tab Genera:
    – Give it a name
    – choose ‘session’
    – link it to a little script on disk that contains api_gitora.login
  • on tab ‘Options’ select the ‘active connection’ and the windows you want the tool to work in
    Close the dialog.

Add the tool to the menu (the tab ‘Menu’ in the tools dialog i did not get to work):

  • right click somewhere in the menu gray area, and select ‘Customize’
  • on second tab ‘Command’ the last in the list (scrll down to see it) is ‘User defined tools’
  • click on your tool name and you can drag and drop the tool somewhere in a menu.

Now if you have an SQL window open, you can just click your tool button and it will log you into Gitora in the same session as the window…

  1. create an on-logon trigger in the database that connects you to Gitora automatically once you make a connection to the db

Any of these options should do the trick.

I created a little blog with a more elaberate answer (with some pics) here:

Good Luck,
Michiel A.

Hello, thank you very much.
1 option - works well


You’re welcome. Glad it helped