Interfaces
You can work with your warehouse database in the following ways:
- From the web console
- REST API
- Connect applications or your favorite tools from your local computer
- Use IBM Db2 Warehouse SaaS as a data source for your IBM Cloud apps or services
Web console
The web console provides a graphical interface for everything that you need to use your database, including: load facilities, an SQL editor, driver downloads, and more.
![Web console opens to the dashboard page View of the web console dashboard page](images/uc.png)
You can access your web console in the following ways:
- From your IBM Cloud dashboard - You can open the web console from the Service Details page for your IBM Db2 Warehouse SaaS service.
- Direct URL - You can bookmark the URL of the web console for your IBM Db2 Warehouse SaaS service.
REST API
With Db2 Warehouse on Cloud service plans, you can do tasks that are related to file management, loading data, and resource scaling using the database management REST API
Connect applications or your favorite tools from your local computer
Configure your local environment to connect to your IBM Db2 Warehouse SaaS database by completing the following steps:
- Download the driver package from the IBM Db2 Warehouse SaaS web console.
- Install the driver package on the computer where your apps or tools are running:
- Configure the driver files for your IBM Db2 Warehouse SaaS database.
Use Db2 Warehouse on Cloud as a data source for your IBM Cloud apps or services
Apps that are hosted on IBM Cloud can connect to your IBM Db2 Warehouse SaaS database the same way as your local applications connect to your IBM Db2 Warehouse SaaS database.
When your apps use the IBM Cloud platform, you can take advantage of the VCAP _SERVICES
environment variable to simplify the task of specifying database details and credentials:
-
On your IBM Cloud dashboard, in the Connections tab of the Service Details page for your IBM Db2 Warehouse SaaS service, click the Create connection button.
-
Select the IBM Cloud app to use with your IBM Db2 Warehouse SaaS database as a data source, and then click the Connect button.
-
Update your application code to retrieve database details and credentials from the
VCAP_SERVICES
environment variable:Example without
VCAP_SERVICES
<?php $driver = "DRIVER={IBM DB2 ODBC DRIVER};"; $database = "BLUDB"; # Get these database details from $hostname = "<Host-name>"; # the Connection info page of the $port = 50001; # web console. $user = "<User-ID >"; # $password = "<Password>"; # $dsn = "DATABASE=$database;" . "HOSTNAME=$hostname;" . "PORT=$port;" . "PROTOCOL=TCPIP;" . "UID=$user;" . "PWD=$password;"; $conn_string = $driver . $dsn; $conn = db2_connect( $conn_string, "", "" ); ?>
Example with
VCAP_SERVICES
<?php $driver = "DRIVER={IBM DB2 ODBC DRIVER};"; $vcap = json_decode( getenv( "VCAP_SERVICES" ), true ); $dsn = $vcap[ "dashDB" ][0][ "credentials" ][ "dsn" ]; $conn_string = $driver . $dsn; $conn = db2_connect( $conn_string, "", "" ); ?>