MS SQL Server Azure - PHP msssql_connect()连接到不同于master的数据库

我只能使用PHP mssql模块与
MS Azure SQL Server一起使用。</ p>

我能够通过添加以下内容来维护连接:
~ / .freetds.conf:</ p>

  [aftermath] 
database = mydatabase
host = myhostname .database.windows.net
port = 1433
tds version = 8.0
</ code> </ pre>

我在PHP中的代码</ p>

 <  code> $ myServer =“aftermath”
$ myUser = username @ hostname
$ myPass = clearly_my_pass

$ dbhandle = mssql_connect($ myServer,$ myUser,$ myPass)
或者死掉(“无法连接 到$ myServer上的SQL Server“);
</ code> </ pre>

但当我检查选择了哪个数据库时,它返回:</ p>

  master 
</ code> </ pre>

而不是我在freetds.conf文件中指定的所需数据库</ p>

模块sqlsrv未安装在 我的托管,我无权安装它。</ p>

你能告诉我如何解决这个问题吗?</ p>
</ div>

展开原文

原文

I am restricted to use only PHP mssql module to use with MS Azure SQL Server.

I am able to maintain connection by adding: ~/.freetds.conf:

[aftermath]
    database = mydatabase
    host = myhostname.database.windows.net
    port = 1433
    tds version = 8.0

My code in PHP

$myServer = "aftermath"
$myUser = username@hostname
$myPass = obviously_my_pass

$dbhandle = mssql_connect($myServer, $myUser, $myPass)
  or die("Couldn't connect to SQL Server on $myServer");

But when I check which database is selected it returns:

 master

instead of my desired database which is specified in my freetds.conf file

Module sqlsrv is not installed on my hosting and I do not have rights to install it.

Can you tell me how can I resolve this issue?

dongtuan8547
dongtuan8547 请参阅:stackoverflow.com/questions/18452262/...
一年多之前 回复
donglian1384
donglian1384 该主题中提供的答案是使用未在我的主机上安装的模块的sqlsrv函数。我无法使用它
一年多之前 回复
douzhe9075
douzhe9075 PHPmssql_connect()可能与Azure数据库重复
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐