This topic is locked

ConnectionManager->getConnection MsSql

8/1/2016 11:12:38 AM
PHPRunner General questions
P
PHPRunnerExplorer author

Re: PHPRunner 8.1
Hi,
While trying to resolve a sql error, I noticed that the getConnection() routine doesn't return anything for mssql:
case "mssql":

case "compact":
The generation application works fine from PHPrunner's internal server, starting from menu.php. But we're calling menu.php from another application, and that results in the getConnection() function returning nothing, and then generating an error.
So, when ConnectionManager->byId( $connId ) is executed, and this statement is run,
$this->cache[ $connId ] = $this->getConnection( $connId ) ;
getConnection() returns nothing, and the error is generated.

P
PHPRunnerExplorer author 8/2/2016

With the working (local) version,
useMSSQLWinConnect() returns true, and
isSqlsrvExtLoaded() returns false.
With the NON-working (server) version that returns the error,
useMSSQLWinConnect() returns false, and
isSqlsrvExtLoaded() returns true.



Re: PHPRunner 8.1
Hi,
While trying to resolve a sql error, I noticed that the getConnection() routine doesn't return anything for mssql:
case "mssql":

case "compact":
The generation application works fine from PHPrunner's internal server, starting from menu.php. But we're calling menu.php from another application, and that results in the getConnection() function returning nothing, and then generating an error.
So, when ConnectionManager->byId( $connId ) is executed, and this statement is run,
$this->cache[ $connId ] = $this->getConnection( $connId ) ;
getConnection() returns nothing, and the error is generated.

P
PHPRunnerExplorer author 8/2/2016

Been at this, a couple of days now. My manager is suggesting that I'm wasting time, and maybe need to just write the code from scratch.
The scenario that we're working with, is that our parent programs does the login to the application (depending on their Windows Authentication), and uses a special web user id and password for the web user to login to our Sql Server database. So we don't need a login, inside the PHPRunner application.
But it doesn't matter what choice is picked - No Login or HardCoded - PHPRunner's code keeps returning the sql error, when called from the parent server application.



With the working (local) version,
useMSSQLWinConnect() returns true, and
isSqlsrvExtLoaded() returns false.
With the NON-working (server) version that returns the error,
useMSSQLWinConnect() returns false, and
isSqlsrvExtLoaded() returns true.

P
PHPRunnerExplorer author 8/3/2016

As one last resort, we tried re-doing everything in PHPRunner 9.0, accepting all the defaults.
We tried both No Login, and Hardcoded. In both cases, we get this message:
Fatal error: 18456 [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

18456 [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

in C:\inetpub\selfExclusion\output\connections\MSSQLSrvConnection.php on line 52
Searching the web for this message returns a lot of symptoms and solutions, but nothing that seems to be relevant in our case.
Note that none of other tools we've worked with, has this problem. PHPRunner is definitely the most flexible PHP Development tool we've tested, but we can't seem to get past this error without doctoring the generated source.



Been at this, a couple of days now. My manager is suggesting that I'm wasting time, and maybe need to just write the code from scratch.
The scenario that we're working with, is that our parent programs does the login to the application (depending on their Windows Authentication), and uses a special web user id and password for the web user to login to our Sql Server database. So we don't need a login, inside the PHPRunner application.
But it doesn't matter what choice is picked - No Login or HardCoded - PHPRunner's code keeps returning the sql error, when called from the parent server application.

Admin 8/3/2016

As far as I can see you are trying to use Windows Authentication while connecting to SQL Server. While this is possible setup can be quite complicated. You can have better luck connecting to SQL Server using SQL Server authentication.
More info:

http://xlinesoft.com/asprunnerpro/docs/error_login_failed_for_user_machine_name_iusr_machine_name.htm

P
PHPRunnerExplorer author 8/4/2016

I don't know if this is possible, admin, but will look into it. I'm not the DBA for our Sql Server database. Also, I'm not clear on how to set up odbc sources that the web server has access to. On my own desktop, using the ODBC Administrator, no problem.
If this were a jvm environment, then it wouldn't be an issue, I could just throw in the jars and any native libraries if needed.
Anyway, for the time being we went ahead and hard-coded the login, in the connection routines. We'll change it later, as we understand the PHPRunner codebase.
Speaking of the code base, I have a documentation question, will be posted in a thread.



As far as I can see you are trying to use Windows Authentication while connecting to SQL Server. While this is possible setup can be quite complicated. You can have better luck connecting to SQL Server using SQL Server authentication.
More info:

http://xlinesoft.com/asprunnerpro/docs/error_login_failed_for_user_machine_name_iusr_machine_name.htm