Quantcast
Channel: SQL Server Data Access forum
Viewing all 4164 articles
Browse latest View live

Kerberos Configuration Manager for SQL Server is available

$
0
0
This thread describes the Microsoft Kerberos Configuration Manager diagnostic tool for SQL Server. This tool is available for download from the Microsoft Download Center: 
DownloadDownload the  package now.
 

About Kerberos Configuration Manager

The Kerberos Configuration Manager for SQL Server is a diagnostic tool that helps troubleshoot Kerberos related connectivity issues with SQL Server, SQL Server Reporting Services (SSRS), and SQL Server Analysis Services (SSAS). It can perform the following functions:
  • Collect information on operating systems and Microsoft SQL Server instances that are installed on a server.
  • Report on all Service Principal Name (SPN) and delegation configurations on the server.
  • Identify potential problems in SPNs and delegations.
  • Fix potential SPN problems.

More information

This tools helps troubleshoot the following exceptions:
  • 401
    Note: This error message is for http errors, SSRS errors, and some other similar errors.
  • Login failed for user 'NTAUTHORITY\ANONYMOUS'
  • Login failed for user '(null)'
  • Login failed for user ''
  • Cannot generate SSPI Context
For more information about Kerberos Configuration Manager, go to the following related blogs:


Elvis Long
TechNet Community Support


Can't log in to new user in SQL Server 2014 Express

$
0
0

So I just downloaded this free version of SQL Server and taking time getting used to it. I am now familiar with database and table management in Microsoft SQL Server Management Studio, but I'm still stuck trying to make newly created user accessible from my Visual Studio 2012.

I did exactly what this tutorial told me to do, the user is created, however when I try to open the connection from Visual Studio, it says "SqlException: login failed for user <something>". Which is a funny thing to me, if I enable the Trusted_Connection property in my SqlConnection constructor, I can access the database even if the user ID or password mismatch or non-existent at all.

Any idea how or why? If I can't settle this issue I'm afraid I have to go back to MySql.

display rows as columns for apparel products

$
0
0
http://stackoverflow.com/q/25561746/2490365

Difference in execution time

$
0
0

Hi,

The query following below differs in execution time on two different systems of same hardware and software configuration -- i.e. 1 second and 39 seconds respectively. 

select distinct * from (select sl.Date_Of_Service, sl.SM_ID, sl.Added_to_Queue, c.SA_ID, sl.Remark, wi.Date_Of_Commencement, wi.AMC_Period, wi.Payment_Status, wi.Warranty_Status, wi.Warranty_Type, wi.AMC_Date, wi.Valid_Upto, wi.AMC_Validity, c.Customer_ID, c.Customer_Name, c.Customer_Address, c.Customer_Phone1, c.Customer_Phone2, sa.SA_Name,sa.File_No, sa.SA_Phone, sa.SA_A_Phone from Service_Log sl inner join Warranty_Info wi on sl.WI_ID=wi.WI_ID join Customers c on wi.Customer_ID=c.Customer_ID join Service_Area sa on c.SA_ID=sa.SA_ID join Products p on wi.Product_ID=p.Product_ID where MONTH(sl.Date_Of_Service)=Month(CONVERT(date, getdate())) and YEAR(sl.Date_Of_Service)=YEAR(CONVERT(date, getdate()))  and sa.File_No='H.29' and wi.Is_Active=1 and p.Product_Name<>'Inverter') as table1, (SELECT Customer_ID, Date_Of_Commencement, STUFF((SELECT char(10)+'+ ' +char(10) + Pro_Desc FROM (select sl.*, wi.Product_Serial, wi.Date_Of_Commencement, wi.Warranty_Type, wi.AMC_Period, wi.Payment_Status, wi.Warranty_Status, wi.AMC_Date, wi.Valid_Upto, wi.AMC_Validity, c.Customer_ID, c.Customer_Name, c.Customer_Address, c.Customer_Phone1, c.Customer_Phone2, sa.SA_Name,sa.File_No, sa.SA_Phone, sa.SA_A_Phone, p.Product_ID, p.Product_Name, p.Warranty_Period, p.Pro_Desc from Service_Log sl inner join Warranty_Info wi on sl.WI_ID=wi.WI_ID join Customers c on wi.Customer_ID=c.Customer_ID join Service_Area sa on c.SA_ID=sa.SA_ID join Products p on wi.Product_ID=p.Product_ID  where MONTH(sl.Date_Of_Service)=Month(CONVERT(date, getdate())) and YEAR(sl.Date_Of_Service)=YEAR(CONVERT(date, getdate()) ) and wi.Is_Active=1 ) r2 WHERE r2.Customer_ID = r1.Customer_ID and r2.Date_Of_Commencement=r1.Date_Of_Commencement FOR XML PATH('')), 2, 3, '') AS Product FROM (select sl.*, wi.Product_Serial, wi.Date_Of_Commencement, wi.Warranty_Type, wi.AMC_Period, wi.Payment_Status, wi.Warranty_Status, wi.AMC_Date, wi.Valid_Upto, wi.AMC_Validity, c.Customer_ID, c.Customer_Name, c.Customer_Address, c.Customer_Phone1, c.Customer_Phone2, sa.SA_Name,sa.File_No, sa.SA_Phone, sa.SA_A_Phone, p.Product_ID, p.Product_Name, p.Warranty_Period, p.Pro_Desc from Service_Log sl inner join Warranty_Info wi on sl.WI_ID=wi.WI_ID join Customers c on wi.Customer_ID=c.Customer_ID join Service_Area sa on c.SA_ID=sa.SA_ID join Products p on wi.Product_ID=p.Product_ID  where MONTH(sl.Date_Of_Service)=Month(CONVERT(date, getdate())) and YEAR(sl.Date_Of_Service)=YEAR(CONVERT(date, getdate()) ) and wi.Is_Active=1) r1 GROUP BY r1.Customer_ID, r1.Date_Of_Commencement) as table2 where table1.Customer_ID=table2.Customer_ID and table1.Date_Of_Commencement=table2.Date_Of_Commencement and table1.Added_to_Queue=1 order by table1.Customer_ID

Can anyone tell me what is the issue...

Does setQueryTimeout still spawn a thread with Microsoft JDBC Driver 4.0?

$
0
0

Hi,

Does setQueryTimeout still spawn a thread with Microsoft JDBC Driver 4.0?

This link here indicates this was fixed awhile ago:

http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx

However, we are using Microsoft JDBC Driver 4.0 but are noticing that a setQueryTimeout thread is being spawned (of class com.microsoft.sqlserver.jdbc.TimeoutTimer) for every query we execute.

And, the thread seems to stay around even after the query has finished executing.

Can anyone confirm whether this is actually fixed?

Or, does anyone have any ideas how we can avoid having a new thread spawned for monitoring for a query timeout?

Thanks! 

jdbc driver creates new thread for each statement with a query timeout set

$
0
0
I am profiling a web application that is using the Microsoft JDBC driver, version 1.1 to connect to a sql server 2005 database. Each java.sql.Statement that is created, within the application, gets a query timeout value set on it ( statement.setQueryTimeout(...) ).

I have discovered that the JDBC driver creates a new thread to monitor each Statement and the query timeout value. When the application is under load these threads are getting created faster then they are being destroyed and I am concerned that this will cause a performance problem in production.

One option I have is to remove the query timeout value and the monitor threads will not be created, another is to change JDBC drivers.

I'm curious is there any way to control this behavior so that these threads are not created or are managed more efficiently.  Is there a workaround that anyone is aware of?   Is this considered a bug?

I have found a similar bug here for the 2000 driver:
http://support.microsoft.com/default.aspx/kb/894552

Cheers


SQL Server Agent and OpenDataSource failing

$
0
0

I have a stored procedure that is using an OpenDataSource query to export data from SQL Server into a excel file for download. I’ve installed the “Microsoft Access database engine 2010”, and can see it listed in SQL Server Management Studio under Server Objects > Linked Servers > Providers > Microsoft.ACE.OLEDB.12.0.

If I manually run the stored procedure (when logged in as the OS’s administrator), the stored procedure runs fine, and the export is completed successfully.

The stored procedure is set up to be run periodically by a SQL Server Agent job.

However, if I start the SQL Server Agent job (when logged in as the OS’s administrator), the job fails with the following error message:

Executed as user: NT SERVICE\SQLSERVERAGENT. Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)". [SQLSTATE 42000] (Error 7303) OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error". [SQLSTATE 01000] (Error 7412). The step failed.

I have given the “NT SERVICE\SQLSERVERAGENT” user full control permissions on the destination directory where the export file resides (note that it starts out as an empty file just with the column headers defined).

I’ve applied the following configuration settings to SQL Server:

sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
GO

What am I missing? Can anyone shed any light on what might be causing the failure?

This is running on SQL Server Web Edition 2012 on Windows Server 2012 Standard.

Thanks!

Repair SQL server

$
0
0

I have schedule DTS to import every day few tables. It had been working

great and had no problem. All of a sudden I started getting this error.

ERROR AT DESTINATION FOR ROW NUMBER 100. ERROR ENCOUNTERED SO FAR IN THE

TASK. 1 UNIDENTIFIED ERROR. (SQL Server 2013)

Thanks.


sql server opendatasource not connected after server changed?

$
0
0
hi. We used to fetch data from one server (SQL Server 2008). Now, we have changed to New Server. After changing to new server, we are unable to fetch or connect with sql server. No Error or Warning Messages after execution. pls mention the reason and solution

Microsoft® ODBC Driver 11 for SQL Server® - RedHat Linux - unixODBC 2.3.2

$
0
0

Hi,

I have a multi-threaded C++ application that is working on RedHat 6 and I want to use SQL Server.

So I downloaded and installed the driver from Microsoft: RedHat6\msodbcsql-11.0.2270.0.tar.gz 

I noticed that the installation is verifying the the unixODBC version is 2.3.0 .

Therefore, my first question is: What is the reason that Microsoft limited the driver to unixODBC-2.3.0 only ?

In unixODBC-2.3.0 there are some issues that were fixed in unixODBC-2.3.2, so I would like to use this version. 

To work around this limitation in the driver, I modified unixODBC "configure" script with the following:

Replace this string:

        LIB_VERSION="2:0:0"

With this one:

        LIB_VERSION="1:0:0"

Once this is modified I was able to work with unixODBC-2.3.2.

Therefore, my second questions is: Whether Microsoft will provide support for any issues that I may encounter with this SQL Server driver, when I use it together with unixODBC-2.3.2.

Thanks for the help.

Know Access credential to SQL Server

$
0
0

I have SQL Server 2008 installed in the company and the management studio, we have a software making some CRM tasks and I is a custom made software written with VB, I accidentally changed the "sa" account password, and the software was accessing the SQL server via the "sa" account. the problem that I don't know the old password of "sa" account and I don't have the source code of the software and there is now ".ini" files having the password of any other accessible files. I need some way to have a detailed log in the SQL having the attempting password of access, of some sniffing software.

p.s. I tried the Wireshark but the data was encrypted. 

any help will appreciated.

thank you in advance

Application call to ODBC SQLSetEnvAttr function throw HY011 exception

$
0
0

Hi All,

      I try to use odbc driver manager in my .Net Application.first My .Net runtime is 3.5, odbc function calls(unmanaged functions are  imported to .Net application by dllimport attribute)can work well.but when .Net runtime is upgraded to 4.0,SetEnvAttr function calls

return SQL-ERROR and I call SQLGetDiagRec function  get this error information:Operation invalid at this time.sqlstate value is HY011.

below is my code fragment:

     
  [DllImport("odbc32.dll")]
        extern static short SQLSetEnvAttr(
            IntPtr envHandle,
            ushort attribute,
            IntPtr attrValue,
            int stringLength);

        [DllImport("odbc32.dll")]
        extern static short SQLAllocHandle(
            ushort HandleType,
            int InputHandle,
            out IntPtr OutputHandle);
try
            {
                rc = SQLAllocHandle(SQL_HANDLE_ENV, 0, out sql_env_handle);
                if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO))
                {
                    throw new Exception("SQLAllocHandle: failed to allocate SQL_HANDLE_ENV");
                }                
                rc = SQLSetEnvAttr(sql_env_handle, SQL_ATTR_ODBC_VERSION, (IntPtr)SQL_OV_ODBC3, 0);
                //if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO))
                //{
                //    throw new Exception("SQLSetEnvAttr: failed to set SQL_ATTR_ODBC_VERSION");
                //}
                if((rc == SQL_SUCCESS_WITH_INFO)||(rc == SQL_ERROR)) 
                {
                    short i=1;
                    short rc2;
                    StringBuilder sqlstate=new StringBuilder();
                    int NativeErrorPtr=0;
                    StringBuilder MessageText=new StringBuilder();
                    short BufferLength=256;
                    short TextLengthPtr=0;
                    while ((rc2 = SQLGetDiagRec((short)SQL_HANDLE_ENV,sql_env_handle,i,sqlstate,
                        ref NativeErrorPtr,MessageText,BufferLength,ref TextLengthPtr))!= SQL_NO_DATA)
                        {
                        i++;
                    }
                }

my operation system is win7 64bit. Could someone help me? thanks

How do you allow SQL Server 2014 Express for remote connection and in firewall?

$
0
0

I'm sorry if this was answered here before.

I installed SQL Server 2014 Express and it is working perfectly. I want my server to be accessed through LAN. It is a named instance.

I searched the internet and here's what i did:

1. Through the SQL Configuration manager, I enabled all the Protocols of my Instance (TCP/IP, Named Pipes and Shared Memory). I changed in the IP Addresses the "IP ALL" TCP Dynamic Ports to 1434.

2. In the Firewall I made an Inbound Rule to allow the Program (%ProgramFiles% (x86)\Microsoft SQL Server\MSSQL12.MyInstance\MSSQL\Binn\sqlservr.exe)

3. I also made 2 Inbound Rules to allow (TCP/IP Port 1433) and (UDP Port 1434).

4. Restarted my instance. SQL Server Browser and  SQL Server Reporting Services are also running.

5. No Luck I cant still access the server using a different computer in the network.

Please help.

Microsoft.SqlServer.Management.Smo

$
0
0

This is probably NOT a SQL server question, but I don't know where else to ask it.  I hope someone can help me/point me to the right forum.

I have imported some code from an old project into my current one:  The Imports ('Using' in C#) is:

Imports Microsoft.SqlServer.Management.Smo  But this gives a compile error in the new project.

I have added references to both Microsoft.SqlServer.Smo and Microsoft.SqlServer.SmoExtended but Intellisence only shows Microsoft.SqlServer.Server  

Microsoft.SqlServer.Management isn't there

What is wrong?

Thanks

what is best procedure method for FK key in tow table for select?

$
0
0

hi for all

what is best procedure method for FK key in tow table for select?

example:

table1: table1_id , table2_id , etc1

table2: table2_id , name , last_name , etc2

i want select this →  table1.table1_id , table2.name , etc1


how create a procedure , that input arguman is a column name!? and select this with table_name.@column_name

$
0
0

hi for all

please see this↓ code

create procedure [dbo].[user_access_check](@user_id int,@access_column varchar(100)) as
BEGIN 
select t_role.@access_column from t_role inner join t_user on t_role.role_id = el_user.role_id
end

but error:

Msg 102, Level 15, State 1, Procedure user_access_check, Line 3 Incorrect syntax near '@access_column'.

SQL server connection issues

$
0
0

Hello All,

I have to develop a desktop application in Javascript to access SQL server and pull specific data based on user's input. Say if the user enters customer code all the customer details will show up in the javascript Window. Since SQL connection from Javascript can have security issues, I'm looking for alternative to it.

I also tried to work with Adobe Air but they have poor documentation on SQL Connection. Can anybody please give me hand on this? What options you guys suggest to meet my requirement?

Thanks


remote login failed for user 'SAID\Guest'

$
0
0

Hi All,

I have two connected computers via router, running under same home group. Each is a i3 pc running win 7. SQL Server 2008 is installed on one as server (back end) and Access 2007 on the other as client (front end), where tables in Access database were migrated to SQL Server via SQL Server Migration Assistant for Access (when Access database was located on server before it was moved to client). To try to access data on server, I went through 'SQL Server does not exist or access denied' problem, then after attempts to fix network parameters I got the message 'login failed for user 'SAID\Guest', where 'SAID' is the server name and 'Guest' is an account name that has been created on server as a result of my try to access data. First account was turned off, then I turned it on, while the server was (and still) under an administrative account. SQL Server authentication was 'Windows only', then I turned it to 'Windows and SQL Server', followed by restart of SQL Server. Message still persists. Any solution? Bear in mind I need to remain on server under the administrative account.

Best regards.

Prof. Dr. Said El Noshokaty

Query AD via ADSI

$
0
0

Hi,

I used to run a daily job to query the AD and store the info in the local table. One fine day it failed from then onwards.

ADSI. Security used is login's current context.
------------------------------------------------
/****** Object:  LinkedServer [ADSI]    Script Date: 09/04/2014 17:16:08 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'ADSI', @srvproduct=N'Active Directory Services 2.5', @provider=N'ADsDSOObject', @datasrc=N'adsdatasource', @provstr=N'ADSDSOObject'
 /* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'ADSI',@useself=N'True',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'rpc', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'rpc out', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'use remote collation', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO
Query
------
SELECT * 
FROM OpenQuery ( 
  ADSI,  
  'SELECT displayName, telephoneNumber, mail
        , SAMAccountName        
  FROM ''LDAP://DC=mydm,DC=local''
  WHERE objectClass =  ''Person'' 
    AND objectCategory = ''User''
  ')
Error
-----  
  Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT displayName, telephoneNumber, mail
        , SAMAccountName        
  FROM 'LDAP://DC=mydm,DC=local'
  WHERE objectClass =  'Person' 
    AND objectCategory = 'User'" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI". 

Any idea ? I'm able to test the linked server ADSI successfully. Is there a raw test when I can query the AD ?

TIA !

JDBC execution of a stored procedure generates a different plan from SQL Server Management Studio

$
0
0

We are experiencing a performance issue whereby we are executing a stored procedure from a client using SSMS and it runs in virtually no time at all. Through JDBC (via user app or DBeaver) it takes minutes.

I've captured the query plan via the Query Profiler and the query plan is significantly different between the SSMS plan and the DBeaver JDBC plan, which is a suboptimal plan. We are well versed in general SQL Server perf tuning but am at a loss as to understand why two plans are created. We have executed the proc using WITH RECOMPILE to eliminate the plan being cached between each test.

The JDBC driver is V4 and the target server is 2008 R2 (Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)   Jun 17 2011 00:54:03   Copyright (c) Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) )

Are there any obvious areas to look in order to research this please? I've checked the ansi settings on the connections using DMVs and they look identical.

We are about to retest on a 2008 R2 server at a later patch level also.

regards


Ken E

Viewing all 4164 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>