Advertisement
nlozovan

Theony remote DB connection

Sep 1st, 2020
6,328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3.  
  4. $database = 'PT';
  5. $server =  '50.247.***.***';
  6. $user = '***********';
  7. $password = '********';
  8. $port  = '********';
  9.  
  10. var_dump('---------- 1 -------------');
  11.  
  12. $connection = odbc_connect('Driver={Unify SQLBase};Server=' . $server . ';dbname=' . $database . ';dbdir=/opt/Unify/SQLBase/;ini=/opt/Unify/SQLBase/sql-theoni.ini;', $user, $password);
  13. $sql = "SELECT MAX(WPPSONO) FROM IMPORTWEBORDHDR";
  14.  
  15. var_dump('---------- 2 -------------');
  16.  
  17. try {
  18.   $orders = odbc_exec($connection, $sql);
  19. } catch (Exception $e) {
  20.   // Does not enter here
  21. }
  22.  
  23. // Does not get to this point. Other SQLs seem to work, or at least do not fall in error.
  24. var_dump('---------- 3 -------------');
  25.  
  26. var_dump($orders);
  27. odbc_result_all($orders, "border=1");
  28.  
  29. odbc_close($connection);
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement