Data Access :: Remote Data Object In VB5 To Get Current Login User?
Jul 13, 2015
I'm using a legacy application built using VB5 and SQL Server 7. After recompiling it, and putting the database in SQL Server 2012. I want to access the current login user using the SQL function SUSER_SNAME().
This is the code.
Set rdoRes = goDatabase.Connection.OpenResultset("select suser_sname()")
But I'm unable to get the current user login in the application. If I write any other SQL statement instead of this, then it runs. But only this statement is not running. Is there any security reasons for this?
trying to connect to sql server 2005 over the internet. (its a third paty hosting company i'm using)
so i have to connect via tcp/ip using sql server authentication.
my laptop is running vista.
the version of sql server 2005 on my laptopis developer edition with service pack 2.
it worked fine from windows xp and the connection details are valid as it runa fine from .net on the hosting website.
i have added sql serer managemnt studio to the exceptions list in the firewall.
ihave made sure tcpip is enabled in the sql server connection management console.
i have also enabled it in the cliconfg tool
firewall on/off seems to make no difference.
its almost enough to make you turn to oracle and thats saying something considering how long i've been in the microsoft camp...
the error returned is: Login failed for user 'SQL2005_152092_garethbowen'. (.Net SqlClient Data Provider)
------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476
------------------------------ Server Name: 'xxxx',1433 Error Number: 18456 Severity: 14 State: 1 Line Number: 65536
I have a windows 2008 with SQL Server 2008 R2 VM on Azure. I am trying to connect to the SQL server for the first time using SSMS, but have not been able it. I have a VPN tunnel, so I am connecting using Windows authentication. The error I get back from SSMS is:
Login failed for user 'domainusername'. (Microsoft SQL Server, Error: 18456).In the event viewer I see this error message: Login failed for user 'domainusername'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: <local machine>]
I have done the following:
- created an endpoint for port 1433 - opened port 1433 in the firewall - Ran the MSSQLSERVER service as the build-in users Network Services, Local System, and Local Service, and as a local and domain administrator, with the same exact result each time. - I get the same result trying to connect locally or remotely. - I get the same result trying to connect using sqlcmd.
Hi when i try and open a database in sql server management studio i get the error "Cannot open user default database. Login failed. Login failed for user 'DOMAINUser'. (.Net SqlClient Data Provider)", what can i do to rectify this, i have googled around and still havent found no answers.
Hi all, Can someone explain it to me why I am getting the following error when I try to connect SQL server express with .NET 2.0?
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.Here is my code and i am using windows authentication: <%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.SqlClient" %> <% Dim connAkaki As SqlConnection Dim cmdSelectAuthers As SqlCommand Dim dtrAuthers As SqlDataReader connAkaki = New SqlConnection("Server=.SQLEXPRESS;database=akaki") connAkaki.Open() cmdSelectAuthers = New SqlCommand("select Firstname from UserTableTest", connAkaki) dtrAuthers= cmdSelectAuthers.ExecuteReader() While dtrAuthers.Read() Response.Write("<li>") Response.Write(dtrAuthers("Firstname")) End While dtrAuthers.Close() connAkaki.Close() %>
but i am able to login to the same remote sql server through SQL server managment studio express using the details i am using in the connection string in the "test.aspx" page. ERROR:An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)When this page is run, i want all the user's UserName and Password to be dispalyed.However, i am getting the above mentioned error.what could be the problem? This is the code i am using in my test.aspx page to connect to "Login" table in my database. 1 Imports System.Data2 Imports System.Data.SqlClient3 4 Private Sub GetAllTheComments()5 6 Dim MyConnection As SqlConnection7 8 Dim MyCommand As SqlDataAdapter9 10 MyConnection = New SqlConnection("server=XXX.X.XXX.X;uid=X;pwd=X;database=X")11 12 MyCommand = New SqlDataAdapter("select UserName, Password from Login", MyConnection)13 14 ds = New DataSet15 16 MyCommand.Fill(ds)17 18 DataList1.DataSource = ds19 20 DataList1.DataBind()21 22 End Sub
Is there any way to get more information for when IAuthorizationExtension::CheckAccess fails to grant access to a report item for the current user? Specifically, it would be useful to know:
1. URL of attempted report 2. IP address of user agent 3. Identity of current user 4. Date/Time of the failed attempt
Im trying to use a .NET IPAddress in my UDT. i create the assembly, but i get this error when i try to create the type in SQL Server:
Type "IPAddress.IPAddressUDTType" is marked for native serialization, but field "address" of type "IPAddress.IPAddressUDTType" is not valid for native serialization.
From what i understand about the IPAddress object in .NET it is serializable. what am i doing wrong
( note, im just doing this for research purposes and not planing to use the UDT)
suppose the sql format is userInformation:userID, age, genderaaa 15 malebbb 20 femaleccc 25 male while userID maps to username: aaa->a; bbb->b; ccc->cthe one use "a" as username to login an asp.net page, how can i get age and gender information of "aaa"?like: SELECT age, gender FROM userInfomation WHERE ...?
I have an MS SQL Server 2000 database running on a local area network. The database contains product info that I would like to use to populate a web catelog being hosted off site.
Can someone point me in the right direct regarding common practices for using this product database, which is updated on a regular basis, to update my Web catelog?
I was thinking periodically the Web server could remotely query my product database for new entries (this does not need to be real time).
I've been developing desktop client-server and web apps and have used Access and SQL Server Standard most of the time. I'm looking into using SQL CE, and had a few questions that I can't seem to get a clear picture on:
- The documentation for CE says that it supports 256 simultaneous connections and offers the Isolation levels, Transactions, Locking, etc with a 4GB DB. But most people say that CE is strictly a single-user DB and should not be used as a DB Server. Could CE be extended for use as a multi-user DB Server by creating a custom server such as a .NET Remoting Server hosted through a Windows Service (or any other custom host) on a machine whereby the CE DB would run in-process with this server on the machine which would then be accessed by multiple users from multiple machines?? Clients PCs -> Server PC hosting Remoting Service -> ADO.NET -> SQL CE
- and further more can we use Enterprise Services (Serviced Components) to connect to SQL CE and further extend this model to offer a pure high-quality DB Server? Clients PCs -> Server PC hosting Remoting Service -> Enterprise Services -> ADO.NET -> SQL CE
Seems quite doable to me, but I may be wrong..please let me know either ways
I come before you seeking assistance on a package that basically flows very much like the "Table Driven foreach Loops" example provided by Kirk Haselden at http://sqljunkies.com/WebLog/knight_reign/archive/2005/03/25/9588.aspx
I am presently encountering the following exception:
Error: 0x3 at Shred the contents of the variable: Variable "User::FullResultSet" does not contain a valid data object
Warning: 0x80019002 at Shred the contents of the variable: The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
Warning: 0x80019002 at DW CUST_CNCL_ORDhardcodedate: The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
I am trying to use RDA.pull to pull data from SQL server 2000 to sql mobile, but it fails when some columns are included in the SQLSelectString, though the datatypes involved are only char, float, smallint and smalldatetime, and nothing is longer than 30. Since there is a very large number of columns, it is difficult to isolate the guilty one by trial and error! Coud someone please help?
I am unable to run a stored procedure that accesses a linked Oracle database as a dataset for a deployed report in Reporting Services. I receive the following error:
An error has occurred during report processing.
Query execution failed for data set 'spName'.
Access to the remote server is denied because the current security context is not trusted.
A few facts ...
The report previews fine in Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600) report designer with VS being installed on my local machine and a shared data source referencing Server1 The deployed report on Server2 produces the error The stored procedure code is similar to the following:
SELECT x.FieldName as OracleField
,y.FieldName as SSfield
FROM OracleLinkedServer..DatabaseName.TableName x
LEFT JOIN Server1.dbo.TableName y
The deployed report runs fine when the stored procedure code is changed as follows. This indicates to me that the problem is truly an Oracle connection issue;
SELECT 'ABC' as OracleField
,y.FieldName as SSfield
FROM Server1.dbo.TableName y
The Oracle database is a linked database on both SQL Server1 and on SQL Server2 database engines. (I don't see where in Server2 Reporting Services I can specify additional server connections.) I've tried to trick Mr. Reporting Services on Server2 by creating a @L_TempTable in my stored procedure, inserting the data into it, then selecting from a SQL Server1.dbo.TableName LEFT JOIN @l_TempTable, but Server2 still knows I'm trying to get out to Oracle and rewards me with the error. I can effectively run the Server1 stored procedure script on Server2 through MSSMS -- it's just the deployed report that references the stored procedure that doesn't work The data source properties of the deployed report are as follows:
Select -- A Custom Datasource
Connection Type: Microsoft SQL Server
Connectoin String: Data Source=Server1;Initial Catalog=DatabaseName
Select -- Credentials stored securly in the report server
Username: UserName
Password: Password
Check -- Use as Windows credentials when connecting the the data source
Check -- Impersonate the authenticated user ...
(Please do not get sidetracked on the 'A Customer Datasource' selection above. I'd rather be using a shared data source, but right now, this is just the way it is.)
Anyone's expertise would be greatly appreciated. We have a great data warehouse but sometimes you just have to go back to the Oracle ERP and slug it out. What do I need to do to get a deployed report to effectively read from a stored procedure that references an Oracle table?
In SQL 2005, from a stored procedure in a local database I am attempting to execute a remote stored procedure in another database on another server. I am getting the error referred to in the Subject when the local stored procedure tries to execute the remote stored procedure. A couple of comments:
The remote database is set up as a linked server in the local database. As part of the linked server definition I selected the 'be made using this security context', and provided a local user name and password. The remote database is set to Trustworthy. I have tried every combination of WITH Execute As on the remote stored procedure but nothing works. I can query against the remote database successfully within Management Studio. I can even execute the remote stored procedure successfully from within M.S., but not from within my local stored procedure when it is run.
I am unable to run a stored procedure that accesses a linked Oracle database as a dataset for a deployed report in Reporting Services. I receive the following error:
An error has occurred during report processing.
Query execution failed for data set 'spName'.
Access to the remote server is denied because the current security context is not trusted.
A few facts ...
The report previews fine in Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600) report designer with VS being installed on my local machine and a shared data source referencing Server1 The deployed report on Server2 produces the error The stored procedure code is similar to the following:
SELECT x.FieldName as OracleField
,y.FieldName as SSfield
FROM OracleLinkedServer..DatabaseName.TableName x
LEFT JOIN Server1.dbo.TableName y
The deployed report runs fine when the stored procedure code is changed as follows. This indicates to me that the problem is truly an Oracle connection issue;
SELECT 'ABC' as OracleField
,y.FieldName as SSfield
FROM Server1.dbo.TableName y
The Oracle database is a linked database on both SQL Server1 and on SQL Server2 database engines. (I don't see where in Server2 Reporting Services I can specify additional server connections.) I've tried to trick Mr. Reporting Services on Server2 by creating a @L_TempTable in my stored procedure, inserting the data into it, then selecting from a SQL Server1.dbo.TableName LEFT JOIN @l_TempTable, but Server2 still knows I'm trying to get out to Oracle and rewards me with the error. I can effectively run the Server1 stored procedure script on Server2 through MSSMS -- it's just the deployed report that references the stored procedure that doesn't work The data source properties of the deployed report are as follows:
Select -- A Custom Datasource
Connection Type: Microsoft SQL Server
Connectoin String: Data Source=Server1;Initial Catalog=DatabaseName
Select -- Credentials stored securly in the report server
Username: UserName
Password: Password
Check -- Use as Windows credentials when connecting the the data source
Check -- Impersonate the authenticated user ...
(Please do not get sidetracked on the 'A Customer Datasource' selection above. I'd rather be using a shared data source, but right now, this is just the way it is.)
Anyone's expertise would be greatly appreciated. We have a great data warehouse but sometimes you just have to go back to the Oracle ERP and slug it out. What do I need to do to get a deployed report to effectively read from a stored procedure that references an Oracle table?
I am making a WPF app, and I want to use SQL Server Compact 4.0 for database management, but it doesn't support Remote data access, on the other hand SQL Server Compact 3.5 does support it but I can't use it in WPF ( I've installed it but can't add it in my project, it's not there in the templates). So is there any alternatives, for a light DBMS, that are not installed separately?
We've got 3 SQL Servers all SQL Server 2012. We have a Master server and 2 production servers (let's call them A and B). The Master has linked servers defined for both A and B in an identical way.
A and B both have the same databases and each has a Stored Proc that gets called by the Master server. An SQL Agent job executes the stored proc on both A and B. It works fine against A but not B.
If we execute the stored proc in a query window under our windows account (domainowner) it works, if we use SetUser to pretend to be the SQL Server Agent account (let's call it domainagent) A works and B doesn't.
Executing against B returns the error "Access to the remote server is denied because the current security context is not trusted."
domainagent is a sysadmin on both Server A and B.
Trustworthy is set to ON in both the Master Server Database it's executing from and the remote databases on both A and B.
All 3 databases have the same owner (let's call it domainowner).
I am sorry for posting this question here. The only reason I am doing so is because Remus answered a question similar to this late last year, but I couldn't get access to the whole thread.
In SQL 2005, from a stored procedure in a local database I am attempting to execute a remote stored procedure in another database on another server. I am getting the error referred to in the Subject when the local stored procedure tries to execute the remote stored procedure. A couple of comments:
a.. The remote database is set up as a linked server in the local database. As part of the linked server definition I selected the 'be made using this security context', and provided a local user name and password. b.. The remote database is set to Trustworthy. c.. I have tried every combination of WITH Execute As on the remote stored procedure but nothing works. d.. I can query against the remote database successfully within Management Studio. I can even execute the remote stored procedure successfully from within M.S., but not from within my local stored procedure when it is run.
I have two win2003 servers. One is IIS and the another is SQL server. Ican use MyConnection=newSqlConnection("server=SQLServerName;database=myDBName;UID=sa;PWD= mypwd")to access my data. But I can not use MyConnection=newSqlConnection("server=SQLServerName;database=myDBName;IntegratedSecurity=SSPI") to access it. If I put both IIS and SQL Server in onemachine, I can do anything. How can I do something to allow trustedauthority work ?Thanks
I have a stored procedure servicing a queue (sql 2005). The stored procedure updates some data in a different server and database. If the queue contains messages and I execute manually the stored procedure, I don't have any problem at all. However, if I set the queue to use the same stored procedure, it gives me the following error:
Error 15274: Access to the remote server is denied because the current security context is not trusted.
when i browser the page on browser the following error dispaly " System.Data.SqlClient.SqlException: Login failed for user xxxx "sqlAdaptor , sqlconnection and dataSet are all fine. i can even preivew dataset, but i don't know while it doesn't display in browser.
System.Data.SqlClient.SqlException: Cannot open database requested in login 'MYKYTYNMDB'. Login fails. Login failed for user 'OMM_IUSER'. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at DreamweaverCtrls.DataSet.GetConnection(String strConnection) at DreamweaverCtrls.DataSet.DoInit()
i have just exported all objects from one sql server to another and no matter how many times i check the password i keep getting this same error.. I KNOW for a fact that the password and username are correct and that they have all of the correct permissions.. what am i doing wrong?
Hello guys and girls! I need help for this error. Could anyone be so kind to enlighten me on this? Thanks! When i attempted to login to my local page, this occurred:
I am having a very strange and frustrating problem with moving an application from Development to Production. I have been working on this application on XP with VS2005 with SQL Express on my local machine. Throughout the development lifecycle I have moved it to the Server multiple times to test things and everything has been working fine until this last time. What I have done since the last time: Added some ASP.NET AJAX functionality Added some views that I am having to fill a dataset from the dataset to manipulate the data before presentation. Everything has worked fine without any issues on my local machine with my local database. I just made backups of the databases and restored them on the server and have moved all my project files up to the server. I then installed the ASP.NET AJAX Extensions 1.0 on my 2.0 server.
NOW - The Problem: The entire site works fine, I can read data from every table of every database, and I can also write data to all the databases. However, this one page has a GridView that I pull data from the database and fill a DataSet with the data. I then manipulate the data, adding some data from other databases and then present it to the browser. This is working fine on my local machine, but since pushing this to the server I get an error: System.Data.SqlClient.SqlException: Login failed for user 'ext_access' Line 36: ad.Fill(ds, "CaskInfo")Line 37: Dim Table As DataTable = ds.Tables("CaskInfo")Line 38: Table.Columns.Add("Company", GetType(String)) I have checked the database and the SQL Server and the user listed above has the correct access to the database, which I would guess since everthing else is working fine. I use the same connection information throughout the app and it is stored in the web.config so I am certain nothing is wrong with my connection information. I access that information with the same code throughout the application as well so I know it is correct. I know this may not be the most trimmed piece of SQL code, but I figured I would post it incase there is something inefficient in my SQL that could be causing this. Here is my code leading up to the error. Dim conn As SqlConnection = CreateConnection2()Dim connectionString As String = conn.ConnectionString Dim myConnection As New SqlConnection(connectionString)Dim ad As New SqlDataAdapter("Select CaskID, CompanyID, SiteID, UnitIDVCC, UnitIDTSC, DATEPART(mm,DateLoaded)as Month, DATEPART(dd,DateLoaded)as Day, DATEPART(yyyy,DateLoaded)as Year, COCName, AmendmentName, HeatLoad, Dose, DryTime, Damaged, Debris FROM CaskInfo, COCInfo, AmendmentInfo WHERE CaskInfo.COC = COCInfo.COCID AND CaskInfo.Amendment = AmendmentInfo.AmendmentID", myConnection) Dim ds As New DataSet() ad.Fill(ds, "CaskInfo")
Using this connection code:Function CreateConnection2() As SqlConnection Dim conn2 As SqlConnection = New SqlConnectionconn2.ConnectionString = ConfigurationManager.ConnectionStrings("MainWeb").ConnectionString conn2.Open()Return conn2 End Function And this is the line in the web.config: <add name="MainWeb" connectionString="Data Source=N2K3APPS;Initial Catalog=NUTUGData;Integrated Security=false;Pooling=False;User Id=ext_access;password=zzzzzzz" providerName=".NET Framework Data Provider for SQL Server"/> Thanks!
I have searched all the forums on this issue and tried the other options but nothing seems to work. I have an IIS server using asp.net to connect to a SQL database on a separate server which also happens to be a domain controller(i.e. no local accounts). I have tried changing the connection string, web.config, etc. but I still can't get connected. I believe the issue is with the SQL security but I'm not sure.
<!-- DYNAMIC DEBUG COMPILATION Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to false will improve runtime performance of this application. Set compilation debug="true" to insert debugging symbols (.pdb information) into the compiled page. Because this creates a larger file that executes more slowly, you should set this value to true only when debugging and to false at all other times. For more information, refer to the documentation about debugging ASP.NET files. --> <compilation defaultLanguage="c#" debug="true" />
<!-- CUSTOM ERROR MESSAGES Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable. Add <error> tags for each of the errors you want to handle.
"On" Always display custom (friendly) messages. "Off" Always display detailed ASP.NET error information. "RemoteOnly" Display custom (friendly) messages only to users not running on the local Web server. This setting is recommended for security purposes, so that you do not display application detail information to remote clients. --> <customErrors mode="Off" />
<!-- AUTHENTICATION This section sets the authentication policies of the application. Possible modes are "Windows", "Forms", "Passport" and "None"
"None" No authentication is performed. "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to its settings for the application. Anonymous access must be disabled in IIS. "Forms" You provide a custom form (Web page) for users to enter their credentials, and then you authenticate them in your application. A user credential token is stored in a cookie. "Passport" Authentication is performed via a centralized authentication service provided by Microsoft that offers a single logon and core profile services for member sites. --> <authentication mode="Windows" />
<!-- AUTHORIZATION This section sets the authorization policies of the application. You can allow or deny access to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous (unauthenticated) users. -->
<authorization> <allow users="*" /> <!-- Allow all users --> <!-- <allow users="[comma separated list of users]" roles="[comma separated list of roles]"/> <deny users="[comma separated list of users]" roles="[comma separated list of roles]"/> --> </authorization>
<!-- APPLICATION-LEVEL TRACE LOGGING Application-level tracing enables trace log output for every page within an application. Set trace enabled="true" to enable application trace logging. If pageOutput="true", the trace information will be displayed at the bottom of each page. Otherwise, you can view the application trace log by browsing the "trace.axd" page from your web application root. --> <trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="false" />
<!-- SESSION STATE SETTINGS By default ASP.NET uses cookies to identify which requests belong to a particular session. If cookies are not available, a session can be tracked by adding a session identifier to the URL. To disable cookies, set sessionState cookieless="true". --> <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
<!-- GLOBALIZATION This section sets the globalization settings of the application. --> <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<!-- ADDED BY YURI --> <identity impersonate="true" />
I am using C# in Visual Studio 2008 and remote database as sql server 2008 R2. I want to read remote database table's field value and i have to move that read value to string variable. how to do it.
And my code is :
string sql = "Select fldinput from tmessage_temp where fldTo=IDENT_CURRENT('tmessage_temp')"; SqlCommand exesql = new SqlCommand(sql, cn); exesql.CommandType = CommandType.Text; SqlDataReader rd1 = default(SqlDataReader); rd1 = exesql.ExecuteReader();
I'm very new to this so excuse my naiveity...I have connected my desktop and laptop computer at home, on my desktop I have a series of db's under my default named instance <computername>/sqlexpress and I have created access logins using windows auth. When I connect to the desktop from the laptop using tcp:<computername>sqlexpressuserid I can only see the systemdb's...I am trying to view adventure works, just to see how this remote connection stuff works...any ideas?
I have connected my desktop and laptop computer at home, on my desktop I have a series of db's under my default named instance <computername>/sqlexpress and I have created access logins using windows auth. When I connect to the desktop from the laptop using tcp:<computername>sqlexpressuserid I can only see the system db's...I am trying to view adventure works, which I can see on the desktop fine using the same login...any ideas?