|
This script tests a database connection to a Microsoft SQL Server Database using the mssql PHP extension.
- Save this script as mssql.php in your root folder of your Joomla installation.
- Modify username and password etc in the script
- Open a web browser and load the script, e.g. http://yoursite/mssql.php
If you get a green OK echoed back then the connection was successful. If not, please study the error messages and try to figure out what is the problem.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?php
///////////////////////////////////////////////////
// Joomla-R-Us
//
// Connection test to external MSSQL Database
//
///////////// Configure this /////////////////////
// Host\Instance Name
$host_inst = 'myhost.mydomain.com\SQLEXPRESS';
$username = 'testuser';
$password = 'mypasswd';
///////////// End Configure /////////////////////
// Try connecting to the database
$dbconnect = mssql_connect($host_inst, $username, $password);
if ( $dbconnect ) {
echo '<b><font color="green">OK!</font></b>';
} else {
echo '<b><font color="red">FAILED</font></b>';
}
?>
|
 |