Advertisement
Guest User

Untitled

a guest
Apr 18th, 2016
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. $vcap_services = $_ENV["VCAP_SERVICES"];
  2. $services_json = json_decode($vcap_services,true);
  3. $sqldb = $services_json["sqldb"];
  4. if (empty($sqldb))
  5. {
  6. echo "No sqldb service instance bound. Please bind a sqldb
  7. service instance before";
  8. return;
  9. }
  10.  
  11. $sqldb_config = $services_json["sqldb"][0]["credentials"];
  12.  
  13. $database = 'SQLDB';
  14. $user = 'username';
  15. $password = 'password';
  16. $hostname = 'host';
  17. $port = '50000';
  18.  
  19. $conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
  20. "HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=
  21. $password;";
  22. echo $conn_string;
  23. $conn = db2_connect($conn_string, '', '');
  24. echo "never gets here ";
  25. if (!$conn)
  26. {
  27. print "SQLSTATE value: " . db2_conn_error();
  28. }
  29. echo "never gets here either ";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement