modified tests to read cd_info
This commit is contained in:
parent
707bd41428
commit
8112a8458c
|
@ -4,13 +4,13 @@ Test the Authentication keyword with options SqlPassword and ActiveDirectoryInte
|
||||||
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("autonomous_setup.php");
|
require_once("MsSetup.inc");
|
||||||
|
|
||||||
$connectionInfo = " Authentication = SqlPassword; TrustServerCertificate = true;";
|
$connectionInfo = "Database = $databaseName; Authentication = SqlPassword; TrustServerCertificate = true;";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$conn = new PDO( "sqlsrv:server = $serverName ; $connectionInfo", $username, $password );
|
$conn = new PDO( "sqlsrv:server = $server ; $connectionInfo", $uid, $pwd );
|
||||||
echo "Connected successfully with Authentication=SqlPassword.\n";
|
echo "Connected successfully with Authentication=SqlPassword.\n";
|
||||||
}
|
}
|
||||||
catch( PDOException $e )
|
catch( PDOException $e )
|
||||||
|
@ -20,15 +20,15 @@ catch( PDOException $e )
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $conn->query( "SELECT name FROM master.dbo.sysdatabases" );
|
$stmt = $conn->query( "SELECT count(*) FROM cd_info" );
|
||||||
if ( $stmt === false )
|
if ( $stmt === false )
|
||||||
{
|
{
|
||||||
echo "Query failed.\n";
|
echo "Query failed.\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$first_db = $stmt->fetch();
|
$result = $stmt->fetch();
|
||||||
var_dump( $first_db );
|
var_dump( $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
$conn = null;
|
$conn = null;
|
||||||
|
@ -39,7 +39,7 @@ $connectionInfo = "Authentication = ActiveDirectoryIntegrated; TrustServerCertif
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$conn = new PDO( "sqlsrv:server = $serverName ; $connectionInfo" );
|
$conn = new PDO( "sqlsrv:server = $server ; $connectionInfo" );
|
||||||
echo "Connected successfully with Authentication=ActiveDirectoryIntegrated.\n";
|
echo "Connected successfully with Authentication=ActiveDirectoryIntegrated.\n";
|
||||||
$conn = null;
|
$conn = null;
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,10 @@ catch( PDOException $e )
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Connected successfully with Authentication=SqlPassword.
|
Connected successfully with Authentication=SqlPassword.
|
||||||
array(2) {
|
array(2) {
|
||||||
["name"]=>
|
[""]=>
|
||||||
string(6) "master"
|
string(1) "7"
|
||||||
[0]=>
|
[0]=>
|
||||||
string(6) "master"
|
string(1) "7"
|
||||||
}
|
}
|
||||||
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
||||||
SQLSTATE[IMSSP]: Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
SQLSTATE[IMSSP]: Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
|
@ -4,70 +4,47 @@ Test the Authentication keyword with options SqlPassword and ActiveDirectoryInte
|
||||||
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("autonomous_setup.php");
|
require_once("MsSetup.inc");
|
||||||
/*
|
|
||||||
$connectionInfo = array( "UID"=>$username, "PWD"=>$password );
|
|
||||||
|
|
||||||
$conn = sqlsrv_connect( $serverName, $connectionInfo );
|
$connectionInfo = array( "Database"=>$databaseName, "UID"=>$uid, "PWD"=>$pwd,
|
||||||
|
"Authentication"=>'SqlPassword', "TrustServerCertificate"=>true);
|
||||||
|
|
||||||
|
$conn = sqlsrv_connect( $server, $connectionInfo );
|
||||||
|
|
||||||
if( $conn === false )
|
if( $conn === false )
|
||||||
{
|
{
|
||||||
echo "Could not connect.\n";
|
echo "Could not connect with Authentication=SqlPassword.\n";
|
||||||
print_r( sqlsrv_errors() );
|
var_dump( sqlsrv_errors() );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
$connectionInfo = array( "UID"=>$username, "PWD"=>$password,
|
|
||||||
"TrustServerCertificate"=>true );
|
|
||||||
|
|
||||||
$conn = sqlsrv_connect( $serverName, $connectionInfo );
|
|
||||||
|
|
||||||
if( $conn === false )
|
|
||||||
{
|
{
|
||||||
echo "Could not connect with TrustServerCertificate.\n";
|
echo "Connected successfully with Authentication=SqlPassword.\n";
|
||||||
print_r( sqlsrv_errors() );
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
//if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
|
$stmt = sqlsrv_query( $conn, "SELECT count(*) FROM cd_info" );
|
||||||
|
if ( $stmt === false )
|
||||||
{
|
{
|
||||||
$connectionInfo = array( "Database"=>"master", "UID"=>$username, "PWD"=>$password,
|
echo "Query failed.\n";
|
||||||
"Authentication"=>"SqlPassword", "TrustServerCertificate"=>true );
|
|
||||||
|
|
||||||
$conn = sqlsrv_connect( $serverName, $connectionInfo );
|
|
||||||
|
|
||||||
if( $conn === false )
|
|
||||||
{
|
|
||||||
echo "Could not connect with Authentication=SqlPassword.\n";
|
|
||||||
var_dump( sqlsrv_errors() );
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// echo "Connected successfully with Authentication=SqlPassword.\n";
|
|
||||||
// }
|
|
||||||
|
|
||||||
$stmt = sqlsrv_query( $conn, "SELECT name FROM master.dbo.sysdatabases" );
|
|
||||||
if ( $stmt === false )
|
|
||||||
{
|
|
||||||
echo "Query failed.\n";
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// $first_db = sqlsrv_fetch_array( $stmt );
|
|
||||||
// var_dump( $first_db );
|
|
||||||
// }
|
|
||||||
|
|
||||||
sqlsrv_free_stmt( $stmt );
|
|
||||||
sqlsrv_close( $conn );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$first_db = sqlsrv_fetch_array( $stmt );
|
||||||
|
var_dump( $first_db );
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlsrv_free_stmt( $stmt );
|
||||||
|
sqlsrv_close( $conn );
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
|
||||||
$connectionInfo = array( "Authentication"=>"ActiveDirectoryIntegrated", "TrustServerCertificate"=>true );
|
$connectionInfo = array( "Authentication"=>"ActiveDirectoryIntegrated", "TrustServerCertificate"=>true );
|
||||||
|
|
||||||
$conn = sqlsrv_connect( $serverName, $connectionInfo );
|
$conn = sqlsrv_connect( $server, $connectionInfo );
|
||||||
if( $conn === false )
|
if( $conn === false )
|
||||||
{
|
{
|
||||||
echo "Could not connect with Authentication=ActiveDirectoryIntegrated.\n";
|
echo "Could not connect with Authentication=ActiveDirectoryIntegrated.\n";
|
||||||
print_r( sqlsrv_errors() );
|
$errors = sqlsrv_errors();
|
||||||
|
print_r($errors[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -77,17 +54,20 @@ else
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
|
Connected successfully with Authentication=SqlPassword.
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
int(7)
|
||||||
|
[""]=>
|
||||||
|
int(7)
|
||||||
|
}
|
||||||
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
[0] => Array
|
[0] => IMSSP
|
||||||
(
|
[SQLSTATE] => IMSSP
|
||||||
[0] => IMSSP
|
[1] => -62
|
||||||
[SQLSTATE] => IMSSP
|
[code] => -62
|
||||||
[1] => -62
|
[2] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
||||||
[code] => -62
|
[message] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
||||||
[2] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
)
|
||||||
[message] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
Loading…
Reference in a new issue