Upgrading Sonarqube from 4.5 to 4.5.1 won't work - jruby

I'm trying to updgrade Sonarqube from 4.5 to 4.5.1 on Ubuntu 14.04 64 bits. The package manager serves the new version and it installed apparently without any problem. However, when I try to access the web UI it takes me to the page where it says I need to upgrade the database. So I go to the my_sonar_server/setup page and click upgrade. After few seconds, the following message appears
Exclamation Impossible to upgrade database
Migration failed: An error has occurred, all later migrations canceled: ActiveRecord::ConnectionNotEstablished: no connection available: alter table snapshot_sources modify data longtext .
Please check logs.
The sonar.log has the following exception
2014.11.10 10:04:38 INFO web[DbMigration] MysqlMediumtextToLongtext: migrating
2014.11.10 10:04:42 ERROR web[o.s.s.ui.JRubyFacade] Fail to upgrade database An error has occurred, all later migrations canceled:
ActiveRecord::ConnectionNotEstablished: no connection available: alter
table snapshot_sources modify data longtext
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in
log'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in
execute'
/opt/sonar/web/WEB-INF/db/migrate/600_mysql_mediumtext_to_longtext.rb:42:in
apply'
/opt/sonar/web/WEB-INF/db/migrate/600_mysql_mediumtext_to_longtext.rb:30:in
up'
org/jruby/RubyKernel.java:2223:in send'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in
migrate'
jar:file:/opt/sonar/lib/server/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:293:in
measure'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in
migrate'
org/jruby/RubyKernel.java:2227:in send'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:365:in
migrate'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:491:in
migrate'
org/jruby/RubyProc.java:290:incall'
org/jruby/RubyProc.java:224:in call'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:567:in
ddl_transaction'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:490:in
migrate'
org/jruby/RubyArray.java:1613:ineach'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:477:in
migrate'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in
up'
/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in
migrate'
/opt/sonar/web/WEB-INF/lib/database_version.rb:62:inupgrade_and_start'
/opt/sonar/web/WEB-INF/app/models/database_migration_manager.rb:109:in
start_migration'
org/jruby/RubyProc.java:290:incall'
org/jruby/RubyProc.java:228:in `call'
Any help here would be much appreciated!
Thanks

The problem was that one of tables (snapshot_sources) got corrupted at some point, presumably when we cloned our production server to have a test server.
When I tried to access a particular row on that particular table either through phpmyadmin or the command line, the database connection was lost (mysqld process was restarting itself). I investigated the root of the problem (by digging /var/log/mysql/error.log) along with our IT team, and reached the aforementioned conclusion.
So, the migration of the database was being interrupted because of this, due to the fact that the migration was trying to alter snapshot_sources table to convert the data field from mediumtext to longtext
The way I fixed it was:
Export the production DB (with truncate sentences to empty the tables before importing)
Backup the corrupted DB for further investigation if required
Import the production DB onto the test server
Upgrade SQ from 4.5 to 4.5.1
Hope this helps someone else or at least it is a sort of heads up for Sonar team.

The log is explicit enough: ConnectionNotEstablished. This means that you haven't configured your SonarQube instance correctly to access the database...

Related

Symfony - App uses wrong database name, CLI uses the correct one

hoping to get help with possibly a silly problem. I can't get Symfony to connect to the correct database.
My config line in .env is as follows
DATABASE_URL="mysql://root:root#127.0.0.1:3306/main?serverVersion=mariadb-10.4.27"
Creating a database using CLI works just fine and the database named "main" is created
bin/console doctrine:database:create
Created database `main` for connection named default
Running migration works OK and a table is created in the database
bin/console doctrine:migrations:migrate
WARNING! You are about to execute a migration in database "main" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
> yes
[notice] Migrating up to DoctrineMigrations\Version20230117183120
[notice] finished in 28.6ms, used 22M memory, 2 migrations executed, 3 sql queries
Yet, when I try to access the site from the browser I get the following error
An exception occurred in the driver: SQLSTATE[HY000] [1049] Unknown database 'root'
Clearing the cache doesn't seem to help, I don't see any reference in the code to a database named root. Any clues on how to make Symfony to connect to the "main" database?
Cheers
P.

When run "sonar-runer" throw exception :"Caused by: Unknown database status: FRESH_INSTALL"

I need help
First , it throw exception
cannot load class 'com.mysql.xxx.JDBC'",so I copy the
sonarqube-4.0/extensions/jdbc-driver/mysql/mysql-connector-java-5.1.26.jar
to the /usr/lib/jvm/java-7-sun/jre/lib/ext/
Then I run sonar-runner again, it throws this exception:
Unknown database status: FRESH_INSTALL
My heart is broken , plz help me
I saw this error when the database is empty (no tables are created). Usually tables are created during first start of sonar.
Can you reach sonar by web interface?
Make sure that settings in your conf/sonar.properties file in Sonar directory are correct, these lines should be uncommented.
sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
sonar.jdbc.username: mysqlusername
sonar.jdbc.password: mysqlpassword
Then check if your conf/sonar-runner.properties file in sonar-runer directory has the same settings.
#----- MySQL
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
#----- Global database settings
sonar.jdbc.username=mysqlusername
sonar.jdbc.password=mysqlpassword
Also make sure that the line for default embeded database is commented.
#sonar.jdbc.url: jdbc:h2:tcp://localhost:9092/sonar
Sonar stopped supporting the property "sonar.jdbc.schema" from 4.2 version. Please refer link http://jira.codehaus.org/browse/SONAR-5000. To fix the issue on PostgreSQL based sonar deployment, execute the following SQL command on the database:
ALTER USER $dbUser$ SET search_path to $soanrQubeSchema$
I just encountered the same problem, and I solved it by restarting sonar server after creating proper user and database in mysql.
In fact, sonar server will fill the empty mysql database with many tables after restarting, and that removed the "FRESH_INSTALL" problem.

Trying to migrate SQL Server to MySQL using MySQL Workbench. Error: "[Microsoft][ODBC Driver Manager] Invalid argument value" when migrating data

Long time lurker, first time poster; hoping anyone can help me out.
Im using MySQL Workbench 5.2.41 to migrate a database from SQL Server to MySQL 5.0.8
The entire process goes smoothly: both SQL and MySQL connection Tests are good, the skemea and table create as expected, everything checks out until the 'Bulk Data Transfer' step. At that point I receive this error:
...
Migrating data...
wbcopytables.exe --odbc-source=DSN=SQL Server 11;DATABASE=;UID=sa --target=root#127.0.0.1:3306 --progress --passwords-from-stdin --thread-count=1 --table [GSAClosers_v2] [dbo].[AccountBase] `dbo` `AccountBase`
`dbo`.`AccountBase`:Copying 84 columns of 169530 rows from table [GSAClosers_v2].[dbo].[AccountBase]
ERROR: `dbo`.`AccountBase`:SQLGetData: HY009:10:[Microsoft][ODBC Driver Manager] Invalid argument value `dbo`.`AccountBase`:
Finished copying 0 rows in 0m00s
Copy helper has finished
...
For connectors I'm using Microsoft SQL Server / ODBC Data Source / DSN: SQL Server and for MySQL the IP and port(3306).
SQL Server 2012 Management Studio connects and all operations work as expected.
O, side not: both are on the same localhost machine.
If anyone can shed some light on this I would be forever indebted. Thanks in advance
From here:
[Microsoft][ODBC Driver Manager] Invalid argument value.
Regarding to the error message and code you provided, which seems is
database is invalid or cannot be accessed. That means either the
database does not exist or the user does not have permission to access
the database.
It turns out you need specify the instance after the server name, so
in the server name in the dialog box for creating the ODBC Data
Source, you must enter it as either: MyServer\SQLEXPRESS or
.\SQLEXPRESS
I think you may have a problem connecting to your database from wbcopytables.exe. Keep in mind that this is a separate tool so the fact that you can connect from the rest of the Migration Wizard doesn't imply that you will connect in wbcopytables.exe.
The thing that worries me the most is that your DSN has whitespace characters. This might be interpreted by the Windows terminal as independent command line parameters. One thing you can do is to edit your DSN name removing the whitespaces and try again.
You may also want to connect without a DSN by putting all your connection parameters explicitely as explained in my blog post: How-To: Guide to Database Migration from Microsoft SQL Server using MySQL Workbench.
And, by the way, since MySQL Workbench 5.2.42 is out you should go and get it. The Migration Wizard is pretty new so important bug fixes are likely launched in each recent Workbench release.
In either case I think you should file a bug with your issues with a detailed explanation about how to reproduce it, possible solutions, etc.
Hope this helps.
Ok, got it figured out: un-install java. install java 1.6, use MySQL Migration Tool. change all data types to varchar, ints and bits. run migrations....eat data.

mysql error when attempting to run rspec suite

Since I upgraded to rails 3.1 I've been getting this error on one of my projects when I try to run the specs for it, but only this one project, other rspec suites still run fine:
ruby-1.9.2-p290#rails3/gems/activerecord-3.1.0/lib/active_record/connection_adapters/mysql2_adapter.rb:283:in 'query': Mysql2::Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111): SET FOREIGN_KEY_CHECKS = 1 (ActiveRecord::StatementInvalid)
This also crashes a script/runner I have going in another terminal.
I've tried updating these mysql vars: max_connections, key_buffer, max_allowed_packet, table_cache, sort_buffer_size, read_buffer_size, read_rnd_buffer_size, myisam_sort_buffer_size, thread_cache_size, query_cache_size. And I manually set foreign key checks to 0.
On the rails side I've tried editing my database.yml so that reconnect is true and timeout is an insanely large number, nothing seems to help.

Ruby on rails connection problem

I have a Ruby on Rails project that I was developing on a hosted server but have decided to work on my local windows machine with.
To get started I thought I'd make sure that I could just take my models from the old project and put them in a new project then query them in the console. This fails.
Edit to reflect more accurate problem:
The connection that rails builds to query my models can run only one query then gives the "Not connected" exception for all subsequent queries. Anybody know what's going on? I've checked my configuration, a lot. If there's some setting on mysql server that I don't know about I'd be willing to look at that.
Stack Trace:
Price.find(1)
ActiveRecord::StatementInvalid: Mysql::Error: query: not connected: SHOW FIELDS FROM `prices`
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log'
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/mysql_adapter.rb:320:in `execute'
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/mysql_adapter.rb:466:in `columns'
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:1271:in `columns'
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:1279:in `columns_hash'
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:1578:in `find_one'
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:1569:in `find_from_ids'
from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:616:in `find'
from (irb):2
I've verified that my MySQL database is accepting connections and has the data and structure I expect. I've double checked my connections, etc. Can anyone shed some light?
I found a solution to this problem in an aptana forum.
There it says that the MySQL 5.1 client library doesn't play well with Rails 2.2
The solution they offer is simple: download an older MySQL client library (libmySQL.dll) and copy it to your Ruby\bin folder.
This worked for me (Windows XP, Ruby 1.8.6, Rails 2.3.3, mysql 5.1.33)
Check that you have the latest mysql gem (for rails > 2.1.2)
Verify your config/database.yml file (adapter, passwords). Check that it is set correctly for all the environments (dev, prod test)
Verify that your mysql is running
download an older MySQL client library