What is the way to connect ClearDb Mysql dashboard on Bluemix? - ibm-cloud

I created a ClearDb Mysql database on Bluemix. I got all the data to conect it but i can't do it.
I tried to use Squirrel and i always got a timeout connection.
So i wanted to use the web interface but it asks me a login/password because the area seems restricted.
I got this message on popup :
A username and password are being requested by https://bluemix-eu-gb.marketplace.ibmcloud.com. The site says: "Restricted Site"
I tried to feed the fields with the data found to connect the db : it's failed. I also tried the login/password for Bluemix : failed too...
I tried many other things but the good one.
Maybe i missed something when i created the DB or ... i don't know.
If anyone could give me the (obvious?) trick?

I used SQuirrel and it works fine for me to connect to the ClearDB MySQL database instance.
Here are the steps I followed:
1) Bound your ClearDB MySQL instance to an application (this is step is only needed so you can find your database credentials)
2) In the Bluemix UI select the application you created above, this will open the application dashboard
3) Locate the ClearDB MySQL instance tile and select the "Show Credentials" at the bottom of the tile. You should something similar to this (for privacy I changed ids and password below):
{
"cleardb": [
{
"name": "ClearDB MySQL Database-29",
"label": "cleardb",
"plan": "spark",
"credentials": {
"jdbcUrl": "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/DATABASENAME?user=USERNAME&password=PASSWORD",
"uri": "mysql://USERNAME:PASSWORD#us-cdbr-iron-east-04.cleardb.net:3306/DATABASENAME?reconnect=true",
"name": "DATABASENAME",
"hostname": "us-cdbr-iron-east-04.cleardb.net",
"port": "3306",
"username": "USERNAME",
"password": "PASSWORD"
}
}
]
}
4) Create the alias in SQuirrel and use the values above in the fields, please note that your server name could be different than mine:
Name: MyAliasName
Driver: MySQL Driver
URL: jdbc:mysql://us-cdbr-iron-east-04.cleardb.net:3306/DATABASENAME
User Name: USERNAME
Password: PASSWORD
5) Click Test button to check your connection. Everything should be fine.

Related

Deploying feathersjs app with mongodb

I am trying to deploy my feathersJS app on heroku with mongodb database. I used mLab sandbox plan, I did not configure anything on it. But as there is no documentation or any previous questions about it here I am.
I have made a feathersJS app running with mongodb. But when I deploy it on heroku I always get an error 503, service unavaible (timeout).
Here is in /config/default.json
"mongodb": "mongodb://localhost:27017/api_feathers",
There is may be something to change on this line.
And here production.js
{ "host": "api-feathers-app.feathersjs.com", "port": "PORT" }
As already pointed out you can add the MongoDB URL to your production.json in the mongodb property. Heroku will also set the MONGODB_URI for most MongoDB addons which you can use by changing production.json to::
{
"host": "api-feathers-app.feathersjs.com",
"port": "PORT",
"mongodb": "MONGODB_URI"
}
If you log into mlab and go to your database you should see a connection string. At the bottom of your production.json you should add a line to connect to the mlab database.
Something like:
{
"host": "api-feathers-app.feathersjs.com",
"port": "PORT",
"mongodb": "mongodb://USERNAME:PASSWORD#ADDRESS-AT-MLAB:PORT/DB_NAME"
}
That last line will be provided to you in the mlab settings. In addition mlab may require some query string at the end of the mongodb url, such as ?ssl=true. But they will tell you what is necessary.
Log in to your mlab account and create a new environment if not created already.
Then click on the database name. It will show you tab containing Collections, Users, Stats, Backups and Tools.
Click on the Users tab and it will show you a list of users assigned to that db. If you haven't created a user for that, then you will have to create a user by clicking on the "Add database user" button.
Once the user has been created you then add this to your production.json file. Add this as the value to the mongodb key in production.json file
mongodb://<dbuser>:<dbpassword>#ds115749.mlab.com:15749/<dbname>
replace the <dbuser> with the database username you created earlier and <dbpassword> the password associated to the dbuser and replace with the name of the database you are trying to access.
Here's a full code base for the production.json file
{
"host": "https://your.domainname.com/",
"port": "PORT",
"public": "../public/",
"paginate": {
"default": 10,
"max": 1000
},
"mongodb": "mongodb://<dbuser>:<dbpassword>#ds115749.mlab.com:15749/<dbname>",
}
Please note, default.json is for your development environment while production.json is for your production and used when you are deploying file in the same directory.

Azure Data Factory AWS PostgreSQL RDS as source connection

I am attempting to use an AWS PostgreSQL RDS instance as my source for a data factory pipeline. I am unable to get this connection to work in ADF v1 or v2. I have tried everything from using a PostgreSQL connection to an Azure database for PostgreSQL. Essentially I am going cloud to cloud, and this connection doesn't seem to be supported yet. Has anyone else had any luck doing this?
yes, this is horribly broken as you have found out. Two main problems:
1) You must install the NpgSQL 2.0.14.3. driver (chose core installation option to ensure both x86 and x64 versions are installed) this version won't validate the server certificate
2) PostgreSQL connector can only enter connection information using by uploading via PowerShell the current GUI does not support the full configuration of the data source:
Here is the example json:
{
"name": "PostgreSqlLinkedService",
"properties": {
"type": "PostgreSql",
"typeProperties": {
"server": "<server>",
"database": "<database>",
"username": "<username>",
"password": {
"type": "SecureString",
"value": "<password>"
}
},
"connectVia": {
"referenceName": "<name of Integration Runtime>",
"type": "IntegrationRuntimeReference"
}
}
}
alternatively, the ODBC driver can work around this issue as you need to specify additional properties on the connection string that are not exposed by the pg connector. you need to add the following value to the DSN:
**sslmode=Require;Trust Server Certificate=true*
and that should resolve the error
note: the ODBC nor the Postgresql Connector's currently work with the ADF v2 Lookup activity.

db.serverStatus() returns "not authorized to execute command" on mlab w/ owner privileges

I recently opened up a free mLab account, and I'm trying to access the number of open connections in my database through the shell.
I never had problems with the command line when I was running mongodb locally, but now nothing works.
To connect I do this:
mongo ds127044.mlab.com:27044/db_name -u db_user -p db_password
And it show I'm successfully connected.
After that I run:
db.serverStatus()
And get:
{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { serverStatus: 1.0 }",
"code" : 13,
"codeName" : "Unauthorized"
}
But according to my console I'm listed as the owner of the db:
{
"_id": "db_name.db_user",
"user": "db_user",
"db": "db_name",
"roles": [
{
"role": "dbOwner",
"db": "db_name"
}
]
}
Is there something I'm doing wrong in the command line or is it something particular to my account with mLab?
Seems to be something related with your user's roles.
All documentation here: https://docs.mongodb.com/manual/reference/built-in-roles/#cluster-admin-roles/ (specifically cluesterMonitor information)
Say:
...The admin database includes the following roles for administering the
whole system rather than just a single database...
And in this Doc https://docs.mongodb.com/manual/core/security-built-in-roles/
Say:
Every database includes: Database Administration Roles... The
admin database includes the following roles for administering the
whole system: Cluster Administration Roles
'serverStatus' is realted to clusterMonitor role so..
Try to change it:
roles: [ { role: "clusterMonitor", db: "admin" },
{ role: "dbOwner", db: "db_name" }]
Good luck!
Not a mongodb expert, but here's what I found in the docs.
db.serverStatus() shares instance info in its output. For example:
host
The system’s hostname. In Unix/Linux systems, this should be the same as the output of the hostname command.
mLab wouldn't expose host info to end users, who should only have access to the dbs they're creating--specifically, the db you logged into.
Similarly, you'll run into issues with other calls like show dbs, since that would expose all the dbs (including dbs for other users!) existing alongside your own.
I imagine that the only commands that will work are ones that expose info completely related to only your db. I suggest hitting up a more export mongodb admin perhaps in a separate question for that definitive list, if necessary.
I fixed this exact issue by changing my mac settings to allow remote login.
System Preferences -> Sharing -> Remote Login: On

Explicitly set user schema in Bookshelf for PG

In our dev environment, each dev has their own schema to replicate the stage and prod databases. Need to be able to pass user schema as part of the client config. Here's the config...
"client": {
"username": "user_login",
"password": "user_password",
"host": "db_host",
"port": 5432,
"database": "db_name",
"dialect": "pg",
"schema": "user_schema"
}
...and here's the instantiation...
var Knex = require('knex')({
client: client.dialect,
connection: {
host: client.host,
user: client.username,
password: client.password,
database: client.database,
searchPath: client.schema
});
var Bookshelf = require('bookshelf')(Knex);
Inspecting the Bookshelf and Knex objects, I can't determine anywhere which schema is being used. I had to dig into the SchemaCompiler_PG.prototype.hasTable method, where I happened to find it in an array on a query response object, which includes a property of table_schema, happily set to public. I tried to set it to my schema, but nothing succeeded.
So we set default search paths for each user login.
ALTER ROLE user_login SET search_path TO 'user_schema'
Inspecting the response object, table_schema was set to my search path. But when another dev tried to run the code on her machine (local instances of Node and PG), that response object was set to MY schema. We can find no way to manually set it.
No idea what kind of black magic that would be, but need to know how to set the user schema for Bookshelf/Knex/PG.
While I haven't been able to find an answer for the original question, how to set the PG schema, I was able to resolve the issue at hand. Turned out to be a permissions issue in PG. Ensure that all users had r/w perms in their respective search_path and all was well.
No error messages that I could find anywhere within Bookshelf, Knex or PG client pointed to this as a possible culprit, so hopefully this helps somebody.

Oracle SQL Developer and PostgreSQL

I'm trying to connect to a PostgreSQL 9.1 database using Oracle SQL Developer 3.0.04, but I'm not having any success so far.
First, if I add a third party driver on preferences, when adding a new connection there's no tab for PostgreSQL (it works fine for MySQL though). I'm using a JDBC4 version 9.1 driver, but I tried a JDBC3 of the same version and still get the same thing.
Second, there's nothing like manual configuration tab when adding a new connection. The closest is the Advanced option on Oracle tab, where I can provide a custom URL, but it fails because complains about the selected Driver (of course).
Finally, I got connected importing a connection from an XML file (contents below), but it displays only my schemas and doesn't show my tables inside them.
So, my question is: does Orable SQL Developer support PostgreSQL connections? Is there any other way to have my tables being displayed in the ObjectViewer?
<?xml version = '1.0' encoding = 'UTF-8'?>
<References xmlns="http://xmlns.oracle.com/adf/jndi">
<Reference name="Lumea" className="oracle.jdeveloper.db.adapter.DatabaseProvider" credentialStoreKey="Lumea" xmlns="">
<Factory className="oracle.jdeveloper.db.adapter.DatabaseProviderFactory"/>
<RefAddresses>
<StringRefAddr addrType="user">
<Contents>lumea</Contents>
</StringRefAddr>
<StringRefAddr addrType="subtype">
<Contents>thirdParty</Contents>
</StringRefAddr>
<StringRefAddr addrType="customUrl">
<Contents>jdbc:postgresql://localhost:5432/versates</Contents>
</StringRefAddr>
<StringRefAddr addrType="SavePassword">
<Contents>true</Contents>
</StringRefAddr>
<StringRefAddr addrType="password">
<Contents>myencryptedpass</Contents>
</StringRefAddr>
<StringRefAddr addrType="driver">
<Contents>org.postgresql.Driver</Contents>
</StringRefAddr>
<StringRefAddr addrType="DeployPassword">
<Contents>true</Contents>
</StringRefAddr>
</RefAddresses>
</Reference>
</References>
Oracle SQL Developer 4.0.1.14 surely does support connections to PostgreSQL.
download JDBC driver for Postgres (http://jdbc.postgresql.org/download.html)
in SQL Developer go to Tools → Preferences, Database → Third Party JDBC Drivers and add the jar file (see http://www.oracle.com/technetwork/products/migration/jdbc-migration-1923524.html for step by step example)
now just make a new Database Connection and instead of Oracle, select PostgreSQL tab
Edit:
If you have different user name and database name, one should specify in hostname: hostname/database? (do not forget ?) or hostname:port/database?.
(thanks to #kinkajou and #Kloe2378231; more details on https://stackoverflow.com/a/28671213/565525).
I've just downloaded SQL Developer 4.0 for OS X (10.9), it just got out of beta. I also downloaded the latest Postgres JDBC jar. On a lark I decided to install it (same method as other third party db drivers in SQL Dev), and it accepted it. Whenever I click "new connection", there is a tab now for Postgres... and clicking it shows a panel that asks for the database connection details.
The answer to this question has changed, whether or not it is supported, it seems to work. There is a "choose database" button, that if clicked, gives you a dropdown list filled with available postgres databases. You create the connection, open it, and it lists the schemas in that database. Most postgres commands seem to work, though no psql commands (\list, etc).
Those who need a single tool to connect to multiple database engines can now use SQL Developer.
Oracle SQL Developer doesn't support connections to PostgreSQL. Use pgAdmin to connect to PostgreSQL instead, you can get it from the following URL
http://www.pgadmin.org/download/windows.php
I managed to connect to postgres with SQL Developer.
I downloaded postgres jdbc driver and saved it in a folder.
I run SQL Developer -> Tools -> Preferences -> Search -> JDBC
I defined postgres jdbc driver for the Database and Data Modeler (optional).
This is the trick.
When creating new connection define Hostname like localhost/crm? where crm is the database name. Test the connection, works fine.
If there is no database with the same name as the username, then clicking "Choose Database" will fail with an error like "Status : Failure -FATAL: database "your_username" does not exist"
To work around this, put 5432/database_name? in the Port field, where 5432 is the port of your Postgres instance and database_name is the name of at an existing database that your_username has access to. Then click "Choose Database" again and it should work. Now you can choose the database you want and remove the extra /database_name? from the Port field.
I think this question needs an updated answer, because both PostgreSQL and SQLDeveloper have been updated several times since it was originally asked.
I've got a PostgreSQL instance running in Azure, with SSLMODE=Require.
While I've been using DBeaverCE to access that instance and generate an ER Diagram, I've gotten really familiar with SQLDeveloper, which is now at v19.4.
The instructions about downloading the latest PostgreSQL JDBC driver and where to place it are correct. What has changed, though, is where to configure your DB access.
You'll find a file $HOME/.sqldeveloper/system19.4.0.354.1759/o.jdeveloper.db.connection.19.3.0.354.1759/connections.json:
{
"connections": [
{
"name": "connection-name-goes-here",
"type": "jdbc",
"info": {
"customUrl": "jdbc:postgresql://your-postgresql-host:5432/DBNAME?sslmode=require",
"hostname": "your-postgresql-host",
"driver": "org.postgresql.Driver",
"subtype": "SDPostgreSQL",
"port": "5432",
"SavePassword": "false",
"RaptorConnectionType": "SDPostgreSQL",
"user": "your_admin_user",
"sslmode": "require"
}
}
]
}
You can use this connection with both Data Modeller and the admin functionality of SQLDeveloper. Specifying all the port, dbname and sslmode in the customUrl are required because SQLDeveloper isn't including the sslmode in what it sends via JDBC, so you have to construct it by hand.
I got the list of databases to populate by putting my username in the Username field (no password) and clicking "Choose Database". Doesn't work with a blank Username field, I can only connect to my user database that way.
(This was with SQL Developer 4.0.0.13, Postgres.app 9.3.0.0, and postgresql-9.3-1100.jdbc41.jar, FWIW.)
Oracle SQL Developer 2020-02 support PostgreSQL, but it is just the basics by adding postgreSQL driver under jdbc dir and configure by adding as a 3rd party driver.
The supported functionality:
multiple databases which can be selected at connection definition
CRUD operations like query tables
scheme operations
basic modelling support: show tables without pk, fk, connections
Not supported functionalities:
no table or field completion
no indexes are shown in a tab
no constraints are shown in a tab like: fk, pk-s, unique, or others
no table or field completions in the editor
no functions, packages,triggers, views are shown
The sad thing is Oracle should only change the queries behind this view in case of PostgreSql connections. For example for indexes they need to use this query: select * from pg_catalog.pg_indexes;
Except that it will not work if your user name and database name are differents. It sounds like an SQLDeveloper bug and i can't find any workaroud
Maybe there are some bugs in Oracle SQL Developer when it connect to the postgresql.However I connect postgresql with navicat successfully.(My postgresql username and database name are different
host= localhost/postgres? worked for me if you need a schema/database use:
localhost/postgres?currentSchema=myschema
ex: localhost/postgres?currentSchema=public
once connected, you can also use the
[Choose Database] button and pull down
sql developer postgres jdbc url for the rest of us