RE: Re: MS SQL error...I've come a long way to get this far

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





--- On Tue, 12/9/08, Fortuno, Adam <Adam.Fortuno@xxxxxxxxxxxxx> wrote:

> From: Fortuno, Adam <Adam.Fortuno@xxxxxxxxxxxxx>
> Subject: RE:  Re: MS SQL error...I've come a long way to get this far
> To: fredsilsbee@xxxxxxxxx
> Date: Tuesday, December 9, 2008, 5:14 PM
> Sorry! I've been swamped today, and I needed to install
> the PHP module
> for SQL Server before I could respond.
> 
> Fred> integration with Oracle...Linux or Windows?
> Fred> I've got the Linux Oracle 11g1/PHP 5.2.6/ and
> MySQL 
> Fred> connection down...I can email working code.
> 
> Windows. I'm running PHP (in ISAPI mode) on IIS
> integrating with a 9i
> instance on a RedHat box.
> 
> Fred> When I run :
> Fred> <?php
> Fred> // Server in the this format:
> <computer>\<instance name> or 
> Fred> // <server>,<port> when using a non
> default port number
> Fred> $server = 'LANDON\SQLEXPRESS';
> Fred>
> Fred> $link = mssql_connect($server, 'sa',
> 'K^a_t^e_a_u_x_3141');
> Fred>
> Fred> if(!$link)
> Fred> {
> Fred>     die('Something went wrong while connecting
> to MSSQL');
> Fred> }
> Fred>?>
> Fred>
> Fred> I get
> Fred>
> Fred> Warning: mssql_connect() [function.mssql-connect]:
> Unable to
> connect 
> Fred> to server: LANDON\SQLEXPRESS in
> C:\Inetpub\wwwroot\trymssql.php on
> 
> Fred> line 6 Something went wrong while connecting to
> MSSQL
> 
> I installed the PHP module for SQL Server 2005 this
> morning, and I
> updated my php.ini file then restarted IIS. I dumped the
> following into
> a page, and I ran it.
> 
> $server = 'Babylon';
> $uid = 'UserName';
> $pwd = 'FooB@r';
> 
> $connectionInfo = array("UID" => $uid,
> "PWD" => $pwd);
> $link = sqlsrv_connect($server, $connectionInfo);
> 
> if(!$link)
> {
> 	die('Something went wrong while connecting to
> MSSQL');
> }
> 
> It worked without a problem. I downloaded whatever B.S.
> module Microsoft
> had on their site, and here is what I added to my ini:
> 
> My php.ini file includes:
> 
> [SQL_Server_2005]
> extension=php_sqlsrv_ts.dll
> 
> I'm trying a different function than you did. Give my
> script a try.
> 
> A-


THANKS!!!! I'll try it

I downloaded the adventure works .msi file and successfully installed it but found no new tables in my SQL SERVER 2005.

This is from Microsoft:
<?php
/* Specify the server and connection string attributes. */
$serverName = "(local)";
$connectionInfo = array( "Database"=>"AdventureWorks");

/* Connect using Windows Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
     echo "Unable to connect.</br>";
     die( print_r( sqlsrv_errors(), true));
}

/* Query SQL Server for the login of the user accessing the
database. */
$tsql = "SELECT CONVERT(varchar(32), SUSER_SNAME())";
$stmt = sqlsrv_query( $conn, $tsql);
if( $stmt === false )
{
     echo "Error in executing query.</br>";
     die( print_r( sqlsrv_errors(), true));
}

/* Retrieve and display the results of the query. */
$row = sqlsrv_fetch_array($stmt);
echo "User login: ".$row[0]."</br>";

/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>



      


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux