Home » RADICORE » How To » Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern (Do you have any advice about how to structure a program that will be moving data between pgsql and sqlsrv databases?)
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern [message #4787 is a reply to message #4749] |
Sun, 21 June 2015 12:33 |
rafs
Messages: 69 Registered: May 2015
|
Member |
|
|
Connecting to multiple databases part 2.
I am having the same issue as when using the CLI batch script, but now when using web app version.
A var_dump($args) just after entering function pgsql($arg), (and before the error below), shows:
array (size=7)
'dbname' => null
'dbhost' => string 'id********************.com' (length=26)
'dbusername' => string '********' (length=8)
'dbuserpass' => string '***********' (length=11)
'dbport' => string '5432' (length=4)
'dbprefix' => string '' (length=0)
'PGSQL_dbname' => &string 'radicore' (length=8)
Fatal Error: Undefined variable: unbuffered_query
Error in line 78 of file 'C:\xampp\radicore\includes\dml.pgsql.class.inc'.
I ran the debugger against radicore, and have included a screenshot that might help.
Also, including the config.inc file, here:
<?php
// ************************************************************ *****************
// Copyright 2003-2005 by A J Marston <http://www.tonymarston.net>
// Copyright 2006 by Radicore Software Limited <http://www.radicore.org>
// ************************************************************ *****************
// This file contains database access details and the standard connection function
$GLOBALS['dbms'] = 'mysql'; // database engine is MySQL
//$GLOBALS['dbms'] = 'pgsql'; // database engine is PostgreSQL
//$GLOBALS['dbms'] = 'oracle'; // database engine is Oracle
//$GLOBALS['dbms'] = 'sqlsrv'; // database engine is SQL Server (Microsoft)
if ($GLOBALS['dbms'] == 'oracle') {
$GLOBALS['dbhost'] = '//localhost/xe';
$GLOBALS['dbprefix'] = '';
} elseif ($GLOBALS['dbms'] == 'sqlsrv') {
// JOIN clauses in SQL Server require 'dbname.<schema>.tblname'
$GLOBALS['dbhost'] = 'localhost';
$GLOBALS['dbprefix'] = '';
$GLOBALS['SQLSRV_schema'] = 'dbo';
$GLOBALS['serverName'] = '(local)';
$GLOBALS['connectionInfo'] = array('CharacterSet' => 'UTF-8',
'ReturnDatesAsStrings' => true);
} elseif ($GLOBALS['dbms'] == 'pgsql') {
// NOTE: with MYSQL there are tables withing databases, and within a single connection
// it is possible to access tables in any database.
// But with PostgreSQL there are tables within schemas within databases, and within
// a single connection it is only possible to access a single database, but any number
// of schemas within that database.
// When using PostgreSQL you must supply a value for $PGSQL_dbname for the single database
// connection, and what is known as 'dbname' to MySQL becomes 'schema' to PostgreSQL.
$GLOBALS['dbhost'] = 'id*****************.com';
$GLOBALS['dbprefix'] = '';
$GLOBALS['PGSQL_dbname'] = 'radicore';
} else {
$GLOBALS['dbhost'] = 'localhost';
$GLOBALS['dbprefix'] = '';
} // if
// NOTE: $dbprefix is for my web host (shared) where my databases are prefixed
// with my account name to keep them separate from other accounts.
/*
if (preg_match('/^(local\.radicore\.org|127.0.0.1|localhost|des ktop|laptop)$/i', $_SERVER['SERVER_NAME'])) {
// this is for my PC
global $servers;
// server 0
$servers[0]['dbhost'] = $GLOBALS['dbhost'];
$servers[0]['dbengine'] = $GLOBALS['dbms'];
if (isset($GLOBALS['SQLSRV_schema'])) {
$servers[0]['SQLSRV_schema'] = $GLOBALS['SQLSRV_schema'];
$servers[0]['serverName'] = $GLOBALS['serverName'];
$servers[0]['connectionInfo'] = $GLOBALS['connectionInfo'];
} // if
if (isset($GLOBALS['PGSQL_dbname'])) {
$servers[0]['PGSQL_dbname'] = $GLOBALS['PGSQL_dbname'];
} // if
$servers[0]['dbusername'] = 'tony';
$servers[0]['dbuserpass'] = 'tony';
$servers[0]['dbport'] = '';
$servers[0]['dbsocket'] = '';
$servers[0]['dbprefix'] = $GLOBALS['dbprefix'];
$servers[0]['dbnames'] = 'audit,radicore,menu,dict,workflow,classroom,product,survey, xample';
// server 1
$servers[1]['dbhost'] = $GLOBALS['dbhost'];
$servers[1]['dbengine'] = $GLOBALS['dbms'];
$servers[1]['dbusername'] = 'tony';
$servers[1]['dbuserpass'] = 'tony';
$servers[1]['dbport'] = '';
$servers[1]['dbsocket'] = '';
$servers[1]['dbprefix'] = '';
$servers[1]['dbnames'] = '*';
// set these only if secure HTTPS protocol is available on your server
$GLOBALS['http_server'] = 'local.radicore.org';
$GLOBALS['https_server'] = 'local.radicore.org';
$GLOBALS['https_server_suffix'] = '';
//define('HTTPS_NOT_FOR_FILES', true);
} else {
// this is for my shared web host
$GLOBALS['dbusername'] = 'radicore_radicor';
$GLOBALS['dbuserpass'] = 'GrungeBunny';
$GLOBALS['dbprefix'] = 'radicore_';
// set these only if secure HTTPS protocol is available on your server
$GLOBALS['http_server'] = 'www.radicore.org';
//$GLOBALS['https_server'] = 'starburst.secureguards.com/~radicore';
//$GLOBALS['https_server'] = 'neutrino.secureguards.com/~radicore';
//$GLOBALS['https_server'] = 'titan.secureguards.com/~radicore';
//$GLOBALS['https_server_suffix'] = '/~radicore';
// define this only if content such as CSS or JS files are not to be referenced using HTTPS
//define('HTTPS_NOT_FOR_FILES', true);
// converts datetime between client and server timezones (PHP version >= 5.2)
$GLOBALS['server_timezone'] = 'America/New_York';
date_default_timezone_set('America/New_York');
} // if
*/
// this demonstrates the multi-server option (see FAQ92)
if (preg_match('/^(127.0.0.1|localhost|desktop|laptop|id)$/i', $_SERVER['SERVER_NAME'])) {
global $servers;
// server 0
$servers[0]['dbhost'] = 'localhost';
$servers[0]['dbengine'] = 'mysql';
$servers[0]['dbusername'] = 'root';
$servers[0]['dbuserpass'] = '*********';
$servers[0]['dbport'] = '';
$servers[0]['dbsocket'] = '';
$servers[0]['dbprefix'] = '';
$servers[0]['dbnames'] = 'audit,dict,menu,workflow,xample';
$servers[0]['ssl_key'] = '';
$servers[0]['ssl_cert'] = '';
$servers[0]['ssl_ca'] = '';
$servers[0]['ssl_capath'] = '';
$servers[0]['ssl_cipher'] = '';
// server 1
$servers[1]['dbengine'] = 'sqlsrv';
$servers[1]['dbusername'] = '******';
$servers[1]['dbuserpass'] = '*******';
$servers[1]['dbport'] = '';
$servers[1]['dbsocket'] = '';
$servers[1]['dbprefix'] = '';
$servers[1]['dbnames'] = '***';
$servers[1]['serverName'] = 'WIN************'; // test
$servers[1]['SQLSRV_schema'] = 'dbo';
$servers[1]['connectionInfo'] = array('CharacterSet' => 'UTF-8',
'UID' => '*********',
'PWD' => '*********',
'ReturnDatesAsStrings' => true);
// server 2
$servers[2]['dbhost'] = 'id********.com';
$servers[2]['dbengine'] = 'pgsql';
$servers[2]['dbusername'] = 'postgres';
$servers[2]['dbuserpass'] = '************';
$servers[2]['dbport'] = '5432';
$servers[2]['dbsocket'] = '';
$servers[2]['dbprefix'] = '';
$servers[2]['PGSQL_dbname'] = 'radicore';
$servers[2]['dbnames'] = 'newscheme,*';
$servers[2]['ssl_key'] = '';
$servers[2]['ssl_cert'] = '';
$servers[2]['ssl_ca'] = '';
$servers[2]['ssl_capath'] = '';
$servers[2]['ssl_cipher'] = '';
// server
} // if
// set this to true if you want all XSL transformations to be done by the client
// (NOTE: only valid if supported by your client browser)
$GLOBALS['XSLT_client_side'] = false;
// set this to TRUE to write all sql queries to file 'sql/<script_id>.sql' (for debugging)
$GLOBALS['log_sql_query'] = false;
// set date format - choose one of te following
$GLOBALS['date_format'] = 'dmy';
//$GLOBALS['date_format'] = 'mdy';
//$GLOBALS['date_format'] = 'ymd';
// set this to TRUE to write all XML documents to file 'xsl/<script_id>.xml' (for debugging)
if (preg_match('/^(local\.radicore\.org|localhost|desktop|lapto p)$/i', $_SERVER['SERVER_NAME'])
or $_SERVER['REMOTE_ADDR'] == '80.177.120.119') {
$GLOBALS['log_xml_document'] = true;
} else {
$GLOBALS['log_xml_document'] = false;
} // if
// use HTTPS for all web pages
$GLOBALS['use_https'] = false;
// use to access files in the 'classes/custom-processing/<project>/' folder
//$GLOBALS['project_code'] = 'unknown';
// redirect all outgoing emails to this address
//define('MAIL_TO_REDIRECT', 'tony@marston-home.demon.co.uk');
// defines email address(es) to which any error_log will be sent
//define('ERROR_LOG_MAILTO', 'tony@marston-home.demon.co.uk, tonymarston@hotmail.com');
// defines directory into which error logs will be written
define('ERROR_LOG_DIR', $_SERVER['DOCUMENT_ROOT'].'/radicore/error_logs');
/*
if (preg_match('/^(local\.)/i', $_SERVER['SERVER_NAME'])
OR $_SERVER['REMOTE_ADDR'] == '80.177.120.119') {
// causes the logstuff() function to write details to the log file
//define('LOGSTUFF', true);
} // if
*/
?>
[Updated on: Sun, 21 June 2015 12:39] Report message to a moderator
|
|
|
|
|
Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Fri, 22 May 2015 18:14
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Sat, 23 May 2015 09:46
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Tue, 02 June 2015 22:21
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Tue, 02 June 2015 23:28
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Wed, 03 June 2015 05:09
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Wed, 03 June 2015 05:31
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Wed, 03 June 2015 05:32
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Wed, 03 June 2015 06:32
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Wed, 03 June 2015 19:16
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Thu, 04 June 2015 04:37
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Thu, 04 June 2015 18:39
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Fri, 05 June 2015 03:08
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Fri, 05 June 2015 04:47
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Thu, 18 June 2015 12:52
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Fri, 19 June 2015 05:20
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Fri, 19 June 2015 23:48
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Sat, 20 June 2015 04:15
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Sun, 21 June 2015 16:14
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Mon, 22 June 2015 04:48
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Sun, 21 June 2015 12:33
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Sun, 21 June 2015 13:16
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Mon, 22 June 2015 04:20
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: rafs on Wed, 08 July 2015 03:28
|
|
|
Re: Batch Script connecting two databases in an Extract Tranform Load (ETL) Design Pattern
By: AJM on Wed, 08 July 2015 05:17
|
Goto Forum:
Current Time: Fri Nov 22 20:52:31 EST 2024
Total time taken to generate the page: 0.01224 seconds
|