rethinkdb web interface error looking for other database even a database name has been specified - rethinkdb

I'm trying to join two tables by parent id to child row name 'users_id' from the specific database via rethinkdb web interface, below is what I've tried
r.db('cn_chat').table('chat_que').eqJoin('users_id', r.table('connections'));
below is the error given by the web interface
where the expected database must be 'cn_chat' yet the web interface seems looking for the test database which did exist but not the correct database. Any help, ideas please?

The error message gives a good hint: "test.connection" doesn't exist.
When you are using r.table("connection") by default it tries to connect to a db called "test", but your table is in the "cn_chat" i assume.
Try the following:
r.db('cn_chat').table('chat_que').eqJoin('users_id', r.db('cn_chat').table('connections'));

Related

Why do I have to disable Javers' schema management in order to initialize my application?

In my Spring-Boot project when:
javers.sqlSchemaManagementEnabled=true
The Javers tables are created on the first execution (when the tables do not exist on the database) and the code runs as expected, however from the second execution onwards an exception is thrown describing that the tables cannot be created because them already exist. This is the situation that I cannot understand, isn't Javers supposed to know that the tables already exist and do not attempt to create the tables?
javers.sqlSchemaManagementEnabled=false
If the tables where already created on the database, manually or executing the application with this option as 'true' at least once, the application executes as expected.
What am I supposed to do?
Is there something wrong with my Spring-Boot configuration? The application was supposed to run with 'sqlSchemaManagementEnabled=true' even with the tables already created?
I expected is to leave the 'sqlSchemaManagementEnabled=false' and create the tables manually?
I had the same problem, when using other than public schema in PostgreSQL.
I solved it by switching to public schema, now it works correctly with javers.sqlSchemaManagementEnabled=true.
For other schemas, you should somehow specify the schema name in org.javers.repository.sql.schema.TableNameProvider
If javers.sqlSchemaManagementEnabled=true, Javers creates SQL tables if they do not exists already.
It's checked here:
https://github.com/javers/javers/blob/master/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/JaversSchemaManager.java#L215
It's hard to say why it doesn't work in your case, try to debug this code using the latest Javers version.

ORA-02019: connection description for remote database not found

I have created a db link AM_ADMIN through SQL Developer:
I am trying to check if it is a valid database link. When I test it from the SQL Developer wizard it is successful. But when I use the below command:
SELECT * FROM dual#AM_ADMIN
I'm getting the error:
ORA-02019: connection description for remote database not found
How can I rectify this error?
According to your screenshot you created the database link as AM_ADMIN.INT.xxx. You are calling it without the domain, just as #AM_ADMIN. Unless you have a sqlnet.ora which defines names.default_domain with the same domain value (and have SQL Developer configured to recognise that), you will need to fully-quality the link name when you use it:
SELECT * FROM dual#AM_ADMIN.INT.xxx
This error will occur when a database link is not made PUBLIC, and the user who created the link is different to the user attempting to use the link. For example, creating the link as the SYS user and then trying to use the link as the AM_ADMIN user.
In this instance either make the link PUBLIC (which all users can then access), or grant the AM_ADMIN user the privileges to create a database link.
I had the same problem and I found out that it was a stupid error caused by (Description = (... HOST = !...). When you create Database Link in USING clause, you should:
use the keyword HOST if you are using the IP address
use keyword HOSTNAME if you are using the name
I just wanted to share it because I lost half a day trying to figure that out and I couldn't find any information about it...

Hive JDBC fails to connect configured schema

I am able to connect to Hive using hive-jdbc client and also using the beeline.Typical url is,
jdbc:hive2://hive_thrift_ip:10000/custom_schema;principal=hive/hive_thrift_ip#COMPANY.COM
Unfortunately the connection is always established to the 'default' schema of Hive , and it is not considering the configured schema name in the url. I use the org.apache.hive.jdbc.HiveDriver class
It always takes me to the tables of the default schema. Still I am able to access the tables from other schema using the schema name prefix to the tables, like custom_schema.test_table
Kindly let me know if I missed any property or configuration in the connection creation part which will help me in getting the session exclusively for the schema that configure in the url.
Many thanks.

Seting Schema for HSQLDB in JDBC connection

How does one set the schema for HSQLDB in the JDBC URL itself.
Kinda how you can do in MySQL with jdbc:mysql://localhost:3306/
-EDIT-
My current DB url looks like this
jdbc:hsqldb:file:C:\\hsqldb\\dbname
Also inside the dbanme there is a schema newSchema, which can be set using
set schema newSchema,
how do i do this using the jdbc URL itself.
have you already tried the standard protocol?
"jdbc:hsqldb:hsql://[HOST]:[PORT]/myDBName"
How are you trying to connect? through a standalone app or by creating a resource?
You might have seen this but still check here if not done:
http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html#dpc_connection_url
I think need to specify the port number like as shown //192.0.0.10:9500
UPDATE:
I have been doing some more testing. The suggested solution appears to be ineffective.
For example; if I set the schema to Test I still may not use SQL on tables in that schema. Essentially that extra stuff I put in there has no effect, even though I thought it was OK.
select * from BOOKMARKS;
SEVERE SQL Error at '<stdin>' line 5:
"select * from BOOKMARKS"
user lacks privilege or object not found: BOOKMARKS
SquirrelSQL has an option for an initial schema, so queries there work OK. The sqlTool accepts the URI but doesn't change/select the schema. It is slightly frustrating that I can't see HOW to report the current schema name in use btw.
So this answer doesn't solve the problem; I'm leaving it here because it will save the next person time when they find a good answer to the challenge.
back to the drawing board ...
original suggestion ...
I'd like to do this too. For example with mysql the example is:
mysql -h hostname:port schema
The port number, being one port per database. Now in HSQLDB, the URL is one database within a Catalog (that's how they spell it). Here's the solution I came-up with. I have ...
databsee: dev
schemas
public
test
In my RC file, ~/.config/sqltool.rc ...
urlid dev_test
url jdbc:hsqldb:hsql://localhost/dev;set schema test;
username programmer
password secret
I can use the connection ID dev_test to link to the test schema, the normal default is public. And you can run the sql tool with:
java -jar /usr/lib/hsqldb/lib/sqltool.jar --rcFile=~/.config/sqltool.rc dev_tmp
That approach worked with a Groovy Sql connection:
url: 'jdbc:hsqldb:hsql://localhost/dev;set schema test',
...
Worked just how I'd want it. So what I can do is append the schema I want to that URL connection string string. It may no be the solution but it will do what you describe.
Looking at the connection protocol: there is NO option for a schema nor for a catalog. So catalog will be part of your URL, eg. if you use a file base database, that is one catalog.

Getting JDBC user permissions for active connection

I'm trying to come up with proper error codes for connecting to a SQL database via JDBC. Providing the wrong server name or sql instance is very easy since there's an exception to catch. Likewise with invalid username/credentials...
But my problem is that if I get a valid connection, I want to get the user's permissions for a specific database. I could have missed it, but there doesn't seem to be connection.getPermissionsForUser() method or some such thing.. Only thing I can think of is to fire off an insert query to see if I have write permissions or a select query to see if I have read permissions. Those don't seem very eloquent so I was hoping there might be a better way to do this.
Specifically, is there some way to get the permissions of the user in the connection string?

Resources