What is the default sonar database? - sonarqube

I'm trying to reset the admin password of my SonarQube and I have already found that is executing the following query:
update users set crypted_password = '88c991e39bb88b94178123a849606905ebf440f5', salt='6522f3c5007ae910ad690bb1bdbf264a34884c6d' where login = 'admin'
But the thing is that I don't know what is the database manager where I need to execute it and how to connect to it. When I installed my SonarQube and my SonarQube Scanner I didn't specified any database manager.

The only "default" SonarQube database is the embedded H2 database, which is provided solely for initial testing. It is neither intended nor supported for production use. You will not be able to upgrade with this database. As a large red banner should be telling you at the bottom of every single page in the SonarQube interface.
But okay, to answer your question, you can use any generic client to make this update. I generally use SQuirreL SQL on the rare occasions I need to peer into the black box that is the SonarQube database.

Related

Sonarqube authentication

I just installed sonarqube. As part of automation i am required to change the admin password through command line. I see there is a document to reset the admin credentials by running the query. I am wondering where do i run the query.
update users set crypted_password = '88c991e39bb88b94178123a849606905ebf440f5', salt='6522f3c5007ae910ad690bb1bdbf264a34884c6d' where login = 'admin'
I am using official docker image for sonarqube. I logged into container and don't see any mysql, sql, psql installed. So i which DB exactly i need to login and run the query.
You might want to refer this for your question - Installing the Server.
Basically, <install_directory>/conf/sonar.properties has instructions for setting up the database if required.
SonarQube Docker images are using the H2 embedded database, and this one must not be used for production, you should configure SonarQube to use another database (MySQL, Postgresql, Microsoft SQL Server or Oracle).
Then you can run the query in one of those database.
You can also use Web API to change the password of a user such as https://sonarcloud.io/web_api/api/users (this will work with any database)

Sonarqube: why: "H2 database should be used for evaluation purpose only" when there is (evidently) a postgres connection?

When I start the sonarqube 6.1 server, the log contains the message "H2 database should be used for evaluation purpose only". However, the log also indicates that evidently sonarqube is correctly connecting to postgres. Furthermore, this post sonar jdbc properties are not supported anymore in sonarqube 5.3 version indicates that the server doesn't talk to the database at all. So what gives? Is this message always put in the log, or do I need to pay attention? Does the server currently connect to a database or not?

create db - prevent creation of users

On SQL Server 2008R2, we have a SQL login tagged with the sysadmin server role. Anytime a db is created, this login is automatically added as a user to the db. Is there a switch that will prevent this from happening?
EDIT:
Based on the answer below, I am adding more background info to explain why we want to do this.
When we publish to a new database from a Visual Studio SQL project, the publishing engine wants to add a user to the database. The username already exists as a login to the database (in the sysadmin server role -- and not much we can do about that), so the publish fails as the user gets auto-added by SQL server after the 'create database' statement. I was hoping for a switch that would tell SQL Server to not add the user automatically. So it seems we will have to find another solution on the VS side that tells the publishing engine to ignore the SQL DB user.
Assuming you're talking about the sql-server role, I don't think so. TBH if you're contemplating keeping a sys-admin out of a db, then you've got a different problem than the one you think you have...
I have a resolution to this. Download the latest SSDT package from MS and now there are new options under the Publishing Wizard Advanced... button to exclude the publishing of logins, roles, etc. The SSDT package I downloaded I found here...
https://msdn.microsoft.com/en-US/dn864412

SonarQube Add Rules to Profile from database

I've created a new profile from database by adding in rules_profiles table.
It is reflecting on the SonarQube UI
However, when I am adding rules to that profile by inserting records in active_rules table and restarting sonar.It is showing those number of records on the SonarQube UI
but clicking that does not show me proper data.
Do I need to add information to any other tables.
Pls help
I am using Sonarqube 4.4
You will not get any support on this.
Modifying the database is not the right way to add information to SonarQube or customize it. The DB is not an API, it's just an internal storage system for SonarQube.
So either you do it through the Web interface, or through the Web Service API. But not directly on the DB.

Oracle Connection String With Windows Authentication

We have a requirement to make our products work on Oracle as well as SQL Server (around which they were originally built). Unfortunately we don't have any in house Oracle development experience to speak of but as a senior dev it has fallen to me to lead the project. So far I have managed to make our app connect to an Oracle database (I'm using Oracle XE 11.2) by using the following connection string:
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=VS010-ORA11GR1)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=DEVORA)));User Id=dbo;Password=dbo;
The reason we decided to use this type of connection string is because we do not want to rely on changing tnsnames.ora on every client machine. However, as you can see this specifies an Oracle user and associated password. We also need to provide the ability to use the equivalent of SQL Server integrated security.
According to the literature I have read, to do this I simply need to specify / as the user id and then omit the password portion (as this is ignored anyway for Windows authentication). I also created the user in Oracle, making sure it matched the Windows user, with the following snippets:
CREATE USER "OPS$<DOMAIN>\<user>" IDENTIFIED EXTERNALLY;
GRANT CONNECT,RESOURCE TO "OPS$<DOMAIN>\<user>";
I also checked that the sqlnet.ora file on my local machine which hosts the XE instance and my dev environment contained the line:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
I understood that this would enable my app to connect to the Oracle database uing Windows Authentication. However what actually happens is that I get the following Oracle error message:
ORA-01005: null password given; logon denied
this doesn't make much sense because of course its null - it's supposed to be, according to the tutorials I've read.
The app targets .Net Framework 3.5, we are using the System.Data.OracleProvider and the actual connecting and so on is handled by Enterprise Library 5. Incidentally, I am aware of the deprecation of the OracleClient component but I just want this to work before I go into the extra complexities of changing providers.
Can anyone tell me what I'm missing? Have I chosen the wrong type of connection string? I apologise for any basic mistakes but I have always managed to avoid Oracle until now so my knowledge of it is close to zero.
Many thanks
I had the same problem and solved after adding this to conn. string:
Integrated Security=yes
To expand on the answer above by #Stikut. I tested this out with NHibernate 3.3.3.GA and it works.
user id=/;password=;Integrated Security=yes

Resources