I am opening the SQL console from HANA studio by clicking on the schema but it is not connected to database. How can I configure it so that it will open with current schema?
1 Answers
The question is not quite clear. When you can see the list of schemas, you are definitely connected to the database (otherwise SAP HANA Studio wouldn’t be able to show this list).
As I understand the question you like to select one of the schemas from the list and open an SQL editor and want that SQL editor to have the current schema set to the schema you selected.
That behaviour is not implemented in SAP HANA Studio. You can define a default schema for the database connection in the connection properties; otherwise it is always going to be the default schema for the logon user (typically the users’ own schema).
You can also run the SET SCHEMA <schema_name>
command in the SQL editor, but this is not automated.
Be aware that schemas are not the same as databases (e.g. in MS SQL Server). Schemas really are object namespaces within a database. User and privilege management is still done at database level.

- 9,949
- 2
- 15
- 29
-
1Hello Lars, in fact in SQL Server schemas do not map to a database. There is a default database owner schema named "dbo" and since in generall all users prefer to work on this schema and create their objects under this schema there is a general misunderstanding about schemas. In fact just as in HANA, schemas generally map to a group of objects categorized and generally used by a special user or group of users whose permissions are managed for the schema objects. I'ld like to add a picture but could not manage for example sample SQL Server database WideWorldImporters have 6 schemas in it – Eralper Sep 21 '18 at 07:39
-
@Eralper thanks, that’s good to know. I’ve seen many SQL Server users struggling with the schema concept and always referring to it as ‘database’. Interesting choice to mal all users to the default schema. – Lars Br. Sep 21 '18 at 08:10
-
It is a way of avoding permission related issues that might rise when you have a different schema for every user. But if you look at SAP, it also uses a single schema for all users logged on to SAP application – Eralper Sep 21 '18 at 08:17
-
That would only avoid the permission problems if all users also automatically had all privileges on all objects in the default schema. The comparison with the SAP application is not accurate. SAP manages user privileges on application level and all DB accesses are some by a technical user. Still, not all users have access to all data. – Lars Br. Sep 21 '18 at 08:55