How to use command line query (cbq?) for remote (not local) servers

I have searched, but cannot find documentation for connecting to remote server to make queries using command line.

Please advise

cbq -u user -p password -e url

checkout cbq --help

 -e string
    	 Shorthand for  -engine (default "http://localhost:8091/,http://[::1]:8091")
  -engine string
    	 URL to the query service/cluster.
    			 Default : http://localhost:8091
    			 For example : ./cbq -e couchbase://172.6.23.2
    				       ./cbq -e http://172.23.107.18:8091
    	 (default "http://localhost:8091/,http://[::1]:8091")
1 Like

Class.forName(“sun.jdbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:of course:test”);
Statement s=con.createStatement();
ResultSet rs=s.executeQuery(“

“)

Query in space.

Explanation-Import sql package.
Load & Register the Driver.
Create a Connection object.
Create a Statement object.
Execute the statement.
Close Connection.

Three arguments represent name of data source,type of database connectivity being used,authentication)

If given class does not exist in the system ,a ClassNotFoundException is thrown.

From above piece of code:-

String is enclosed in double quotes.
Class.forName(String)
getConnection(String,String,String)

1 Like