From 94fd698ec6891b4ada1738cac86b8e94e2f84d38 Mon Sep 17 00:00:00 2001 From: stan Date: Fri, 10 Jan 2003 22:20:23 +0000 Subject: [PATCH] Added server to database connect calls. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@274 e3e1d417-86f3-4887-817a-d78f3d33393f --- scripts/zmaudit.pl.z | 4 +++- scripts/zmwatch.pl.z | 3 ++- scripts/zmx10.pl.z | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/zmaudit.pl.z b/scripts/zmaudit.pl.z index 7174a7764..720b6adb0 100755 --- a/scripts/zmaudit.pl.z +++ b/scripts/zmaudit.pl.z @@ -36,6 +36,7 @@ # # ========================================================================== use constant DB_NAME => "zm"; +use constant DB_NAME => "zm"; use constant DB_USER => "zmadmin"; use constant DB_PASS => "zmadminzm"; use constant IMAGE_PATH => "@WEB_PREFIX@/images"; @@ -127,7 +128,8 @@ if ( $report && $yes ) usage(); } -my $dbh = DBI->connect( "DBI:mysql:".DB_NAME, DB_USER, DB_PASS ); +my $dbh = DBI->connect( "DBI:mysql@".DB_SERVER.":".DB_NAME, DB_USER, DB_PASS ); + chdir( EVENT_PATH ); if ( !$yes && !$report ) { diff --git a/scripts/zmwatch.pl.z b/scripts/zmwatch.pl.z index fb3725e40..8912a9e98 100755 --- a/scripts/zmwatch.pl.z +++ b/scripts/zmwatch.pl.z @@ -75,7 +75,8 @@ select( STDERR ); $| = 1; select( LOG ); $| = 1; print( "Watchdog starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" ); -my $dbh = DBI->connect( "DBI:mysql:".DB_NAME, DB_USER, DB_PASS ); +my $dbh = DBI->connect( "DBI:mysql@".DB_SERVER.":".DB_NAME, DB_USER, DB_PASS ); + my $sql = "select * from Monitors"; my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); diff --git a/scripts/zmx10.pl.z b/scripts/zmx10.pl.z index 0021a4162..02c50c6a9 100755 --- a/scripts/zmx10.pl.z +++ b/scripts/zmx10.pl.z @@ -168,7 +168,7 @@ sub runServer bind( SERVER, $saddr ) or die( "Can't bind: $!" ); listen( SERVER, SOMAXCONN ) or die( "Can't listen: $!" ); - $dbh = DBI->connect( "DBI:mysql:".main::DB_NAME, main::DB_USER, main::DB_PASS ); + $dbh = DBI->connect( "DBI:mysql@".DB_SERVER.":".DB_NAME, DB_USER, DB_PASS ); $x10 = new X10::ActiveHome( port=>main::X10_DEVICE, house_code=>main::X10_HOUSE_CODE, debug=>1 );