Create a user on OrientDB using console - orientdb

I simply want to create a user in OrientDB 3.0.0m2 using the console.sh.
As said in the documentation, I should be able to execute SQL statements.
Here is my use case.
In terminal 1, run the following:
docker run -it --name orientdb -p "2424:2424" -e ORIENTDB_ROOT_PASSWORD=rootpass orientdb:3.0.0m2
In terminal 2, run the following:
docker run -it --rm --link orientdb:orientdb orientdb:3.0.0m2 /orientdb/bin/console.sh
OrientDB console v.3.0.0m2 (build 4abea780acc12595bad8cbdcc61ff96980725c3b) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> CREATE DATABASE remote:orientdb/db root rootpass PLOCAL
Creating database [remote:orientdb/db] using the storage type [PLOCAL]...SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Connecting to database [remote:orientdb/db] with user 'root'...OK
Database created successfully.
Current database is: remote:orientdb/db
orientdb {db=db}> CREATE USER myuser IDENTIFIED BY userpass ROLE admin
Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:
^
Encountered " <CREATE> "create "" at line 1, column 1.
Was expecting one of:
<IF> ...
<FOREACH> ...
";" ...
<IF> ...
DB name="db"
Error Code="1"
DB name="db"
orientdb {db=db}>
It seems that the console.sh doesn't understand the SQL command CREATE USER. Is this a bug, or am I doing the things in a wrong way?

It was fixed a few hours ago, see https://github.com/orientechnologies/orientdb/issues/7898
You can find the fix in latest snapshot https://oss.sonatype.org/content/repositories/snapshots/com/orientechnologies/orientdb-community/3.0.0-SNAPSHOT/

Related

Hyperledger iroha - schema error while connecting to postgres database

I am trying to deploy Hyperledger Iroha on MacOS (BigSUr) locally, and while running the following command
./build/bin/irohad --config example/config.postgres.sample --genesis_block example/genesis.block --keypair_name example/node0
I get the error
Storage initialization failed: Cannot execute query. Fatal error. ERROR: relation "schema_version" does not exist LINE 1: ... test, iroha_major, iroha_minor, iroha_patch from schema_ver... ^ while executing "select 1 test, iroha_major, iroha_minor, iroha_patch from schema_version;".
I have installed Postgresql DB locally and created the iroha_data database.
Is there a schema that i must load additionally or does it get auto created ?
I was able to overcome this issue by adding -drop_state while starting iroha daemon.

Unable to execute Liquibase update commands via Docker run

I am using docker here to build Liquibase and trying to execute Liquibase commands on fly.
Here is the Dockerfile:-
FROM liquibase/liquibase
RUN lpm add mysql --global
I am using below command on fly
docker run --rm -v ${bamboo.build.working.directory}/:/liquibase/changelog liquibase/liquibase --url="jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema" --changeLogFile=sql/changelog/db.changelog-master.xml --username=username --password=password update
I am getting below error:-
error 04-May-2022 22:08:38 Starting Liquibase at 05:08:38 (version 4.9.1 #1978 built at 2022-03-28 19:39+0000)
error 04-May-2022 22:08:38 Liquibase Version: 4.9.1
error 04-May-2022 22:08:38 Liquibase Community 4.9.1 by Liquibase
error 04-May-2022 22:08:48
error 04-May-2022 22:08:48 Unexpected error running Liquibase: Connection could not be created to jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema with driver org.postgresql.Driver. The connection attempt failed.
Please suggest
From this October 2021 GitHub issue, you need to use single quotes around your JDBC driver URL instead of double-quotes. Try entering it as edited below.
docker run --rm -v ${bamboo.build.working.directory}/:/liquibase/changelog liquibase/liquibase --url='jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema' --changeLogFile=sql/changelog/db.changelog-master.xml --username=username --password=password update

IllegalStateException: Can not connect to database. Please check connectivity and settings

CentOS 7
Docker 20.10.5
In my machine run PostgreSQL 9.5 and success open my db:
localhost:5432/sonar
And success open DB by PGAdmin
Nice.
Now in Docker I installed SonarQube 4.5. And want to connect to my db.
I try this:
sudo docker run -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=sonar -e SONARQUBE_JDBC_URL=jdbc:postgresql://localhost:5432/sonar sonarqube:4.5.7
But I get error:
2021.04.20 11:47:55 INFO web[o.s.s.p.ServerImpl] SonarQube Server / 4.5.7 / e2afb0bff1b8be759789d2c1bc9348de6f519f83
2021.04.20 11:47:55 INFO web[o.s.c.p.Database] Create JDBC datasource for jdbc:postgresql://localhost:5432/sonar
2021.04.20 11:47:55 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-4.5.7.jar:na]
at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:73) ~[sonar-core-4.5.7.jar:na]

GoogleCloudSql Import not fail or succeed

Created mysqldump file and uploaded to bucket: zip_zata_mysqldump and even though import does not show any failure, I don't see the databases created in the db.
How I can see what went wrong so I can fix?
If import failed the operations tab shows a generic error "An unknown error occurred".
To receive a detailed error you can execute the import from command line with the following syntax:
mysql -h MYSQL_INSTANCE_IP -u USER -p DATABASE_NAME < SQL_FILE_TO_IMPORT
For your reference import and export features are documented at [1].
Regards,
Paolo
Link:
[1] - https://cloud.google.com/sql/docs/import-export
For us adding --hex-blob in the mysqldump command allowed us to import. It failed An unknown error occurred without that flag.

Can't Connect to MongoDB from play app with salat: command failed [listDatabases]

I am trying to get started with the salat plugin in playframework. I have configured the database in application.conf and added all the dependencies to Build.scala and added salat to the play.plugins file. I haven't actually added any code to the project yet, I just followed the instructions on the github page, and then tried to run the project. I am getting the following error message
(Server started, use Ctrl+D to stop and go back to the console...)
[info] play - mongodb [default] connected at heroku_app4620908#ds031907.mongolab.com:31907/heroku_app4620908
[error] application -
! #6bchnaacn - Internal server error, for request [GET /] ->
play.api.Configuration$$anon$1: Configuration error [couldn't connect to [ds031907.mongolab.com/107.21.153.211:31907]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:71) ~[play_2.9.1-2.0.3.jar:2.0.3]
at play.api.Configuration.reportError(Configuration.scala:258) ~[play_2.9.1-2.0.3.jar:2.0.3]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:105) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:98) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.3]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.3]
Caused by: com.mongodb.CommandResult$CommandFailure: command failed [listDatabases]: { "serverUsed" : "db-uri" , "errmsg" : "need to login" , "ok" : 0.0}
at com.mongodb.CommandResult.getException(CommandResult.java:88) ~[mongo-java-driver-2.8.0.jar:na
at com.mongodb.CommandResult.throwOnError(CommandResult.java:134) ~[mongo-java-driver-2.8.0.jar:na]
at com.mongodb.Mongo.getDatabaseNames(Mongo.java:356) ~[mongo-java-driver-2.8.0.jar:na]
at com.mongodb.casbah.MongoConnection.getDatabaseNames(MongoConnection.scala:190) ~[casbah-core_2.9.1-2.4.1.jar:2.4.1]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:103) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:98) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
I am stumped because I added my password and everything to the conf file. From the log it looks as though whatever is trying to connect to the database for me, is not logging in first, using the info I provided.
As you say, it looks like the root issue is that MongoDB is rejecting the command "listDatabases". This command requires administrator access to the MongoDB process since it reveals information about the other databases hosted there.
Unfortunately, the message it returns, "need to login", is a little misleading. You have logged in! You just don't have permission to list the databases.
Here's a simple experiment you can try yourself with the MongoDB shell. See that "show dbs" fails with the same error message you got in your app, but "show collections", which doesn't require access to any other databases outside your own, succeeds?
% mongo ds031907.mongolab.com:31907/heroku_app4620908 -u heroku_app4620908 -p your_password
MongoDB shell version: 2.0.7
connecting to: ds031907.mongolab.com:31907/heroku_app4620908
> show dbs
Fri Aug 17 13:12:10 uncaught exception: listDatabases failed:{ "errmsg" : "need to login", "ok" : 0 }
> show collections
system.indexes
system.users
(Note: I did this with my own MongoLab account and modified the text when copying and pasting here so you could just copy it into your terminal.)
Is there a way to avoid making the listDatabases call? I'm not familiar with the framework you're using.
I've the problem as well...
it should come with the SalatPlugin's onStart method that is requesting all database names: source._2.connection.getDatabaseNames().
This code is just testing the aliveness of the server...
I'm gonna check with leon how we could this differently! Sadly, you won't be able to connect until this will be fixed!
Stay tuned on this issue https://github.com/leon/play-salat/issues/23
This is fixed in the latest version of play-salat, it now uses getCollectionNames instead
use admin
db.addUser('userName', 'userPassword')
db.auth('userName', 'userPassword')
show dbs
java:
DB db = mongo.getDB("YouDBName") ;
db.authenticate("userName", "userPassword".toCharArray()) ;
System.out.println(mongo.getDatabaseNames()) ;