jdbc-json / jdbc-cb

A JDBC driver for Couchbase, using the N1QL query language.
Apache License 2.0
16 stars 13 forks source link

jdbc URL template example #61

Open rkmax opened 5 years ago

rkmax commented 5 years ago

Currently, I'm using a template like this

jdbc:couchbase://{host::localhost}?[:{port::8093}][/?][\?<&,user={user},password={password},{:identifier}={:identifier}>]

but when trying to execute a query with a valid user/password I get something like [13014] User does not have credentials to run SELECT queries on the mkpremium bucket. Add role query_select on mkpremium to allow the query to run.

Could you please point me in the right direction

j-larson commented 5 years ago

This example shows how to use credentials: https://github.com/jdbc-json/jdbc-cb/blob/master/examples/UseCredentials.java

You need to create a user who has the Query Select role for the bucket you are trying to access, and provide that user's id and password. You can create a user and assign them roles on the "Security" tab.

j-larson commented 5 years ago

Let me add that how we handle security has changed. We used to have a separate password for each bucket, so you needed to provide credentials for each bucket. Now we assign access credentials to users, so you need to create a user with the right permissions, and include that user and their password in the credentials object.

rkmax commented 5 years ago

Right now I'm trying to use this not from code. I'm using a tool that support .jar drivers for connect to different databases

j-larson commented 5 years ago

jdbc-json is not currently being supported. I recommend you try to use one of the commercial CDATA JDBC drivers. https://docs.couchbase.com/server/current/connectors/odbc-jdbc-drivers.html