开发者

mssql_connect() change default database

开发者 https://www.devze.com 2023-03-04 12:42 出处:网络
When I connect to SQL Server 2005 database, it automatically loads the default database. I can\'t seem to find documentation on loading a different database with the same credentials give开发者_JAVA百

When I connect to SQL Server 2005 database, it automatically loads the default database. I can't seem to find documentation on loading a different database with the same credentials give开发者_JAVA百科n of course the user has access rights.

I believe this is what is occurring because I added a user with an alternate default database and received the expected results. (Problem resolved, but I wanted to know if there is a way to change the default db for future reference). I'm using SQL Server Authentication, if that helps. Thanks!


You want: http://us3.php.net/manual/en/function.mssql-select-db.php


Can you not call mssql_select_db giving it the link identifier returned by mssql_connect? This should preserve the credentials used to open the connection. I cannot see a way to alter the 'default' database in the PHP documentation.

0

精彩评论

暂无评论...
验证码 换一张
取 消