0

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?

Rain Man
  • 1,163
  • 2
  • 16
  • 49

2 Answers2

0

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.

Umberto Manganiello
  • 3,213
  • 9
  • 16
  • The pastebin.com/N4LGRgA6 example can only work as is inside Bluemix since it consumes the VCAP_SERVICES environment. But you should provide in your code a conn_string similar to the one that the example compiles. Actually you should be able to take it mostly from the dashed service credentials that you already have identified. – Torsten Steinbach Jan 07 '16 at 08:11
0

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