IS this permissions issuse ?

Last Post 20 Jan 2009 01:39 AM by vkc12uec. 5 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
vkc12uec
New Member
New Member

--
09 Jan 2009 04:27 AM
HI all,

I am making osql query :
"C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\osql.exe" -U sa -P password -S dell28506\NT_SERVICE -u -i tmpsql.sql -o .\mssqltempfile.o.txt -I -n -w 2048

This query is running fine on Windows Command Prompt, under administrator logon.

NT_SERVICE instance is created using sa/password.

tmpsql.sql = select * from master.dbo.sysdatabases

But when I make a library and start a process which fires query on cmd prompt, it fails.

Does someone has any idea ?
vkc12uec
New Member
New Member

--
12 Jan 2009 05:37 AM
The 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.

Any more info ?

vkc12uec
New Member
New Member

--
19 Jan 2009 12:45 AM
Its important to mention that our process 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)



vkc12uec
New Member
New Member

--
20 Jan 2009 01:39 AM
I am running osql query on Win command prompt in Administrator mode.
vkc12uec
New Member
New Member

--
20 Jan 2009 02:29 AM
My library service is running under LocalSystem account.

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 is DENY"

Windows Prompt query is able to give result, but my library CLI fails. They both have same osql query as stated above.
vkc12uec
New Member
New Member

--
20 Jan 2009 09:38 PM
I want to investigate why the same osql query is able to run on Windows prompt but not through libs ? The db instance to which I am trying to connect has configurations given above.


Acceptable Use Policy
---