Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vkc12uec
Starting Member
5 Posts |
Posted - 2009-01-21 : 02:22:54
|
| HI all,I am making osql query :"C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\osql.exe" -U sa -P getin -S dell28506\NT_SERVICE -u -i tmpsql.sql -o .\mssqltempfile.o.txt -I -n -w 2048This query is running fine on Windows Command Prompt, under administrator logon. Giving me results.NT_SERVICE instance is created using sa/getin ( SQL Authentication ). I am able to connect to this instance using SQL Management Studio.In Security > Logins > BUILTIN\Administrators > Status , I have made "Permission to connect to database engine" option at "DENY" tmpsql.sql = select * from master.dbo.sysdatabasesThe thing is, I want to drill down all the MSSQL instances.I am making a list of all the instances found on my machine, and then getting the databases under them with the use of OSQL query.All this work is made in form of dll library. Code is written in C++. Through my cpp program i am executing CLI on windows prompt. This is where the problem arises. When I make a library and start a process which fires the same query on cmd prompt, it fails.Its important to mention that our process/library is running as System user account on the host. Within the process, we try to execute the command with appropriate user and password credentials required for the specific SQL server. But it fails when the process tries to execute. Although, this is successful from the windows command prompt.The error message we get.1/6/2009 16:03:31.671 [MSSQLExplorer@dell28506] MSSQLExp Error Executing CLI:( "C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\osql.exe" -U sa -P getin -S dell28506\NT_SERVICE -u -i tmpsql.sql -o .\mssqltempfile.o.txt -I -n -w 2048)tmpsql.sql contains (select * from master.dbo.sysdatabases) Does someone has any idea ? |
|
|
|
|
|