Rain Man
Rain Man

Reputation: 1273

How to connect to Bluemix dashDB outside the Bluemix environment

I have several tables in dashDB and I want to access them from another server in order to filter out the data and insert it to a database on my own server.

In dashDB, there is a Service Credentials section and I clicked "Add Credentials" and it outputted a json file with service credentials info.

I tried to run a simple PHP to test the connection :

<?php
$servername = "dashdb-entry-....";
$username = "dash....";
$password = "....";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

and it fails. The error is as follow:

Connection failed: A connection attempt failed because the 
connected party did not properly respond after a period of time, 
or established connection failed because connected host has failed to   respond.

I checked service status of IBM and it seems that everything is running. Is it possible to access the dashDB outside the Blumix environment?

Upvotes: 0

Views: 552

Answers (2)

smurali_ibm
smurali_ibm

Reputation: 46

You should be able to connect to the dashdb on bluemix using PHP. I also found the following link that explains this in detail. http://php.net/manual/en/function.db2-connect.php

You can also use ODBC or JDBC method with proper drivers installed on the client and providing the connection credentials found under the connect --> connection information from the left hand side after you log in.

Murali

Upvotes: 0

Umberto Manganiello
Umberto Manganiello

Reputation: 3233

Yes it is possible to connect to dashDB from outside Bluemix. Here you can find some samples on how to connect to dashDB using several programming languages. Please take a look at the PHP Sample: One first difference I can see is that you are using mysqli while you should use db2_connect as in the sample.

Upvotes: 0

Related Questions