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

[Microsoft][ODBC SQL Server Driver]Communication Link Failure

$
0
0

Several of our customers are getting a message intermitantly throughout the day where the connection is closed.  The message being generated is [Microsoft][ODBC SQL Server Driver]Communication Link Failure.

 

These messages started in the last two weeks.

 

Thanks for any direction that can be thrown my way.

 

David


SQL Server Connection Timeout - pre-login handshake

$
0
0

I have a few ASP.NET web applications that are connecting to Microsoft SQL Server. Two of them tend to sometimes get hit with the following errors. Once it a while this issue happens and sometimes not happening for a couple of days.

Connection Timeout Expired.  The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement.  This could be because the pre-login handshake failed or the server was unable to respond back in time.  The duration spent while attempting to connect to this server was - [Pre-Login] initialization=10; handshake=14992;

The value for initialization and handshake tend to change when it happens. But i'm unsure what does it mean.

I have verified the following:

- The ASP.NET web applications closed the database connection after done using it.

- It is not IPv6 issue.

- Incoming and outgoing for port 1433 is enabled.

The SQL Server and the web applications are in different servers. The applications connect to the database using the hostname defined in the hosts file.

I would like to request for assistance regarding this issue.

Intermitent issue in SQL Server 2008 R2 with Win7 PC

$
0
0

Hi All,

I a getting an intermittent issue in SQL Server 2008 R2 Database with the below details :

[Microsoft][ODBC SQL Server Driver]Communication link failure.

However when I restart the SQL Server this error is gone. It's mostly happening with huge input data.

Could anyone please assist on this ?

Thanks,

Anurag

Resources for transitioning from SNAC to ODBC in Access Databases with ADODB code.

$
0
0

Hello all,

I continue to see progress on the move to ODBC from the SQL server side (no new version for SNAC, references to ODBC, etc) but I am having no luck finding documentation for replacing SNAC when you have an Access database using ADODB to connect to a SQL server.

From the ODBC 11 page microsoft states: "The ODBC Driver for SQL Server contains all the functionality of the SQL Server Native Client ODBC driver that shipped in SQL Server 2012."

I have tried both ODBC 11 and 13 and attempted to create connection strings to be able to use the ADOB library. Nothing so far has worked.

I saw one post that stated OLEDB may be blocked in future SQL versions and another that said that native access in Microsoft applications was still the preferred and supported method. Can anyone provide clarity on this issue?

If a good book or resource exists on this topic could someone please let me know where to get it?

Thanks in advance.

SQL Server ODBC Driver 13.1. Active Directory PW Auth

$
0
0

Hi Guys,

I am running ODBC on a windows 2012 R2 server on the same domain as a server with a SQL Server 12 database.  I have had a Windows Active Directory account created and I wish to use this from within ODBC connection manager to connect to SQL server.

I am hoping that version 13.1 of the driver will allow the Active Directory Password authentication back to Windows Active Directory (even though I don't have Azure setup).   I wish to use the data source to map a permanent metadata library in SAS using the windows AD account such that it can be granted access to various SQL Servers and databases without a SQL Server authentication account needing to be created each time. 

I am receiving the following error from ODBC connection manager after putting in my DOMAIN\USER and PASSWORD:

Connection failed: SQL State '28000'.  SQL Server error '18456'.  [Microsoft][ODBC Driver 13 For SQL Server][SQL Server]Login failed for the user ''.

Really appreciate any help here.  I am hoping that the ODBC Driver is able to authenticate with windows AD as well as AAD.

Cheers,

Simon

Executing DB2 SP on SQL Server 2012 through Linked Server

$
0
0

Hello All,

     I am trying to execute DB2 SP on SSMS(SQL Server Management Studio) using Linked Server.

DB2 SP: when i run the SP CALL Statement on "DB2 I Series", it gives some data(few hundreds of rows).

but when i execute same on SSMS through linked server it showing in result like "(0 row(s) effected)" in SSMS, I need to get same Data which i am getting in DB2 i Series even on SSMS. 

Please help.

Below is  call statement whcih i Ran.

DECLARE @LVC_TRACKNO VARCHAR(30)  = ''
DECLARE @LC_CONTAD_FLAG CHAR(1) = ' '


 EXECUTE  ('CALL DT_DATA.GETSHIP (?,?)',
 @LVC_TRACKDECLAREG_NUMBER,
 @LC_CONTADECLAREER_CLOSE_FLAG) AT DBTEST

Can I configure the default isolation level for all my SSRS reports.

$
0
0

By default connections to SQL Server are made Read Committed. However in a lot of situation this can result on locking of other users when a big SSRS report is executing. Is there a way to configure my SSRS server that it will connect by default with isolation level Read Uncommited to the database.

At this moment you need to specify the transaction isolation level in every dataset of the report. This will result in problems of somebody forget to specify. By configuring this on server or connection level, you know for sure that all reports are executing with Read Uncommitted.

More information about this topic canbe found on my blog: http://www.keepitsimpleandfast.com/2010/11/bad-performance-and-lockings-occur-ad.html

 

 

Connect InfoMessage event is not firing

$
0
0

I'm not able to fire the SQL Connection’s InfoMessage event - here's the code that I've set up
The normal message that i'd expect to see in mSQLMessage is "(12 row(s) affected)"  but the mConnect.InfoMessage is not firing.  Any ideas what I'm missing?

Public Class Dispatch
    Private WithEvents mConnect As SqlConnection
   
    Private Sub SaveSQLMessages(ByVal sender As Object, ByVal e As SqlClient.SqlInfoMessageEventArgs) Handles mConnect.InfoMessage
        mSQLMessage &= e.Message & vbNewLine
    End Sub

    Public Function GetDatatableofJobs() As DataTable
        Dim ds As New DataSet
        mConnect = New SqlConnection
        mConnect.ConnectionString = mStrConnect
        Try
            mConnect.Open()
            Dim da As New SqlDataAdapter("Select * from dbo.vGetPriceItJobs", mConnect)
            da.Fill(ds, "Jobs")
        Catch ex As Exception

        Finally
            mConnect.Close()
        End Try
        Return ds.Tables("Jobs")

    End Function
   
    End Class
   
    The normal message that i'd expect to see in mSQLMessage is "(12 row(s) affected)"  but the mConnect.InfoMessage is not firing.  Any ideas what I'm missing?


Trigger to affect linked server not working.

$
0
0

I have two SQL Servers that are linked. They can browse each other's contents in Enterprise Manager/SQL Management Studio. I can communicate between them using T-SQL statements. But Server A's trigger doesn't insert a new row in a database table on Server B.

Here are some specifics:

  • Server A is SQL 2000. Server B is SQL 2008.
  • The servers are linked to one another with the sa remote login on each machine.
  • I have enabled all RPC communication in both servers' DTC settings.
  • I have disabled authentication requirements on both servers' DTC settings.
  • The DTC service on both servers is running.
  • I can communicate fine using the DTCTester.exe program, going from Server A to Server B.

Here is a snippet from the DTCTester.exe output below:

Executed: dtctester
DSN:  WORM
User Name: sa
Password: xxxxx
tablename= #dtc7290
Creating Temp Table for Testing: #dtc7290
Warning: No Columns in Result Set From Executing: 'create table #dtc7290 (ival int)'
Initializing DTC
Beginning DTC Transaction
Enlisting Connection in Transaction
Executing SQL Statement in DTC Transaction
Inserting into Temp...insert into #dtc7290 values (1)
Warning: No Columns in Result Set From Executing: 'insert into #dtc7290 values (1) '
Verifying Insert into Temp...select * from #dtc7290 (should be 1): 1
Press enter to commit transaction.
Commiting DTC Transaction
Releasing DTC Interface Pointers
Successfully Released pTransaction Pointer.
Disconnecting from Database and Cleaning up Handles

Here is a snippet from the dtctrace.log file showing when the issue occurs during the trigger that's fired on Server A. Looking at Server A's live data stream in a Profiler trace I don't even see the trigger's code being fired.

pid=3164       ;tid=2872       ;time=03/27/2012-13:09:08.512   ;seq=97         ;eventid=TRACE_SETTINGS                           ;;"Trace Configuration (OFF = 0 and ON = 1): Tracing Of DTC = 1, Tracing Of Transactions = 1, Tracing Of Aborted Transactions = 1, Tracing Of Long-Lived Transactions = 1, Tracing Of All Transactions = 1, Max Limit on Memory Buffers = 25."
pid=3164       ;tid=1732       ;time=03/27/2012-13:11:39.120   ;seq=98         ;eventid=TRACING_STARTED                          ;;"MSDTC is resuming the tracing of long - lived transactions"
pid=3164       ;tid=1732       ;time=03/27/2012-13:11:39.120   ;seq=99         ;eventid=TRANSACTION_BEGUN                        ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c     ;"transaction got begun, description : 'Trans1'"
pid=3164       ;tid=2316       ;time=03/27/2012-13:11:39.120   ;seq=100        ;eventid=RM_ENLISTED_IN_TRANSACTION               ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c     ;"resource manager #1001 enlisted as transaction enlistment #1. RM guid = '141451b5-4d22-40f4-a392-b62f5317bfa4'"
pid=3164       ;tid=3172       ;time=03/27/2012-13:11:39.120   ;seq=101        ;eventid=RECEIVED_ABORT_REQUEST_FROM_BEGINNER     ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c     ;"received request to abort the transaction from beginner"
pid=3164       ;tid=3172       ;time=03/27/2012-13:11:39.120   ;seq=102        ;eventid=TRANSACTION_ABORTING                     ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c     ;"transaction is aborting"
pid=3164       ;tid=3172       ;time=03/27/2012-13:11:39.120   ;seq=103        ;eventid=RM_ISSUED_ABORT                          ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c     ;"abort request issued to resource manager #1001 for transaction enlistment #1"
pid=3164       ;tid=1732       ;time=03/27/2012-13:11:39.120   ;seq=104        ;eventid=RM_ACKNOWLEDGED_ABORT                    ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c     ;"received acknowledgement of abort request from the resource manager #1001 for transaction enlistment #1"
pid=3164       ;tid=1732       ;time=03/27/2012-13:11:39.120   ;seq=105        ;eventid=TRANSACTION_ABORTED                      ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c     ;"transaction has been aborted"
pid=3164       ;tid=756        ;time=03/27/2012-13:12:33.853   ;seq=106        ;eventid=TRACING_STOPPED                          ;;"MSDTC is suspending the tracing of long - lived transactions due to lack of activity"

Finally, here is the code for the trigger on Server A, as well as the stored procedure that it should communicate with on Server B.

Server A:

USE [dbsARMS_B01]
GO
/****** Object:  Trigger [dbo].[trgNewRepairJob]    Script Date: 03/27/2012 15:31:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[trgNewRepairJob] ON [dbo].[tbl482_RepairJob]
FOR INSERT
AS

DECLARE @pJobNo varchar(255)
DECLARE @pSiteId varchar(2)

BEGIN
 SELECT
 @pJobNo = JobNo
 ,@pSiteId = CAST(SiteId as varchar(2))
 FROM inserted 
 
BEGIN DISTRIBUTED TRANSACTION;
EXEC [WORM].dcdev.dbo.spcNewRepairJob @pJobNo, @pSiteId; 
COMMIT TRAN;
END

----------------------

Server B:

USE [dcdev]
GO
/****** Object:  StoredProcedure [dbo].[spcNewRepairJob]    Script Date: 03/27/2012 15:33:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER Procedure [dbo].[spcNewRepairJob]
(
@pJobNo varchar(255),
@pSiteId varchar(2)
)

As
set nocount on

Insert into [dcdev].[dbo].[tblRepairJobs](JobNumber, SiteId, Printed)
Values(@pJobNo, @pSiteId, 0)

Any suggestions? I have tried every which way the past two days and spent at least 3 hours researching similar issues. Any help would mean a lot. Thanks!

Passing SQL Server Machine Account From ODBC

$
0
0

Hi guys,

I have had a SQL Server machine account setup within a remote server on the same domain as ODBC from which we wish to connect to the SQL Server in the form DOMAIN\SERVER$

I wish to pass this account from ODBC to SQL Server at all times, however ODBC is currently passing only the domain account of the logged in user which is then being denied by SQL Server.

Really appreciate your help here.  I am running ODBC driver for windows 13.1 and with to pass the machine login using IWA for some DSNs but not all.

Thanks,

Simon

Database is in 'Recovery Pending' Mode When Bitlocker is ON

$
0
0

Hi All,

I am testing out the feature bitlocker recently for security purposes. Therefore, I lock the drive D in order to access by others since all the data files located here. However, when I start SSMS , I found out that the database is in Recovery Pending mode due to the drive (where the db files located) had been locked by bitlocker. So I have to unlock the drive in order to access the database. 

My question is is there any way that I can access the database through SSMS while the bitlocker lock my drive D? 

Hope can get some advice here. Highly appreciated. 

OS version : Windows Server 2012 R2 Standard

SQL version : Microsoft SQL Server 2016 Express 

Best Regards, 

               Han

Microsoft ODBC Driver 13.1 for SQL Server - Linux with Windows Authentication

$
0
0

Hi there,

I've got a Linux box that needs to connect to a SQL Server 2016 database server. If I use SQL account credentials (sa or any other local user), it works fine. However, when I use sqlcmd -S<server>-E, I get:

Error: Microsoft ODBC Driver 13 for SQL Server : Client unable to establish connection due to prelogin failure.

Looking at a Network Monitor trace, it appears as though there is a difference in the way that it is trying to do the TDS Prelogin.

With SQL user:

TDS:Prelogin, Version = Undefined TDS version(0x74000004)

With windows user:

TDS:Prelogin, Version = 7.300000(No version information available, using the default version)

This seems to be where the issue is, but I'm not entirely sure. I've followed all manner of articles on how to set this up, to no avail.

Please can someone assist?

Regards,

Richard

Cannot connect to azure sql database. - South East Asia

$
0
0

Problem!!!!

Cannot connect to Azure SQL database in South East Asia Region.

Appreciate status on this issue

Regards

ROW_NUMBER function

$
0
0
I am having trouble trying to use the ROW_NUMBER function in ACCESS SQL.
The server on my computer is Microsoft SQL Server 2005 Compact Edition [ENU].
I have tried two different pieces of SQL my own as follows:-
 
SELECT A.GAMES, B.COUNTRY, A.GOLD, A.SILVER, A.BRONZE, ((A.GOLD* 1000000)+(A.SILVER* 1000)+A.BRONZE) AS CALCS, ROW_NUMBER()
OVER (PARTITION BY A.GAMES ORDER BY CALCS  desc) AS RowNumber
FROM COUNTRYYEAR AS A, COUNTRYNAME AS B, GAMESLIST AS C
WHERE (((A.GAMES)=[C].[GAMES]) AND ((A.CODE)=[B].[CODE]) AND ((C.TYPE)='S'))
ORDER BY A.GAMES 

The other has been copied from the internet as a so called working SQL statement:-

SELECT
       [PersonID]
      ,[FamilyID]
      ,[FirstName]
      ,[LastName]
      ,[DateOfBirth]
      ,ROW_NUMBER() over(PARTITION BY FamilyID,
                         CONVERT(NVARCHAR(25), DateOfBirth, 111)
                         ORDER BY DateOfBirth ASC) TwinCode

  FROM [People]
ORDER BY PersonID

In both cases, I get "syntax error (missing operator) in query expression ROW_NUMBER(), etc'
Is there a solution to this or am I wasting my time?

nafydrog

about "Remove Sample Applications" of MSADC

$
0
0

We got question from our key customer that following 2 URLs mentioned some files need to be deleted for security issue.

https://technet.microsoft.com/en-us/library/bb687367.aspx

https://msdn.microsoft.com/en-us/library/aa459236.aspx

But our product uses ADO to access MS SQL Server, if we delete those files directly, our product cannot start up anymore.

In fact, in Windows server 2008 and above, we cannot delete those files  since those files are being used by windows services such winlogon.exe.

Here are our questions:

1) Could you please give us a detail description about this security issue ?

2) What shall we do to fix the security issue in our case ?

Thanks!





Can SQLOLEDB work without TLS 1.0 enabled on the SQL Server?

$
0
0

I need to confirm if SQLOLEDB provider can work when TLS 1.0 is disabled. I have to disable TLS 1.0 for security reasons but I have a number of users who connect via SQLOLEDB and so far, I have been unable to connect via SQLOLEDB when TLS 1.0 is disabled.

I am successful with the newer SQLNCLI11 client and would prefer that but many of these users do not have it installed and I need to confirm SQLOLEDB is not going to work before I force the issue with them. Most of the users use Excel 2010 and do a data connection to SQL Server. They end up with a connection string such as:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=Reporting;Data Source=myserver.mycompany.com;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MYWORKST1234;Use Encryption for Data=False;Tag with column collation when possible=False

I have tried many different versions of that connection string and have toggled TLS 1.0 on/off. I cannot get SQLOLEDB provider to work with TLS 1.0 is off. Is it possible? If so, what should the connection string look like?


rp

SQL Server Native Client 11.0 installed in AWS (Redhat Linux server) but fails connection when connecting using isql or sqlcmd.

$
0
0

I installed SQL Server Native Client 11.0 and UnixODBC Driver 2.3.0 successfully in a AWS instance (Linux Redhat server). But when trying to connect through isql or sqlcmd fails to connect. Please help

I assume that DSN with the servername and instance needs to be configured in two places

1) etc/odbc.ini

[SQLServerNativeClient]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/usr/local/lib64/libsqlncli-11.0.so.1790.0
Trace=Yes
Server=tcp:<Server name>\<instance name>,Port number
Trusted_Connection=yes

2) in root .odbc.ini

[SQLServerNativeClient]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/usr/local/lib64/libsqlncli-11.0.so.1790.0
Trace=Yes
Server=tcp:<Server name>\<instance name>,Port number
Trusted_Connection=yes

Also here is the isql command

isql -v SQLServerNativeClient <sql server authentication user name> <password>

When I run isql command,

[S1T00][unixODBC][Microsoft][SQL Server Native Client 11.0]Login timeout expired
[08001][unixODBC][Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
[08001][unixODBC][Microsoft][SQL Server Native Client 11.0]TCP Provider: Error code 0x6E
[ISQL]ERROR: Could not SQLConnect

Also when I ran sqlcmd command, I get this

sqlcmd -S Servername\instance-name

Below is the output when I ran 

SqlState IM002, Data source name not found, and no default driver specified

I am not sure why is not connecting. Any help would be much appreciated.



PowerShell + DataTable + AcceptChanges not working?

$
0
0

I have a PowerShell Script, which executes SQL to Get an DataTable with ExecuteWithResults("SELECT * FROM MyTable")

i.e.

$MyDS = $DB.ExecuteWithResults("SELECT * FROM MyTable")

$MyTable = $MyDS.Tables[0]

# .. changes to the $MyTable are made ie

$MyTable.Rows[0].MYFIELD = 'SomeOtherValue'

# This Actually shows the change, so it appears all is good

Write-Output $MyTable.Rows[0]

# This 'SHOULD' as I understand it, apply the change, however, even though I've made the change, it doesn't get applied to the DB

$MyTable.AcceptChanges()

# If the above one didn't, then as I understand it, this one should.

$MyDS.AcceptChanges()

When I query the table independant of the PowerShell script where I made the change, after it has completed, the value I changes has not infact been changed...

How can I use DataTable with PowerShell to apply my changes to the DB?


George P Botuwell, Programmer

Unable to connect to sql server 2008 database : The target principal name is incorrect.

$
0
0

Hi All,

I am posting same question which already been asked but the solution didn't work in my case.

Backstory : 

I created three certificate using openSSL

1. RootCA certificate(asia.com)

2. Server certificate(myserver.asia.com)

3. Client certificate(myclinet.asia.com)

I installed the RootCA certificate on both the machine(client, server) in trusted root authority folder then sever certificate in personal folder on server machine and client certificate in personal folder on client machine. So far it is good and working correctly with Microsoft SQLOLEDB provider.I used "Use Encryption For Data=True" in connection string for SQLOLEDB provider.The same certificate is working in case of Oracle server-client environment as well.

Now when it comes to .net environment, It is throwing an error "A connection was successfully established with the server, but then an error during the login process. (provider: SSL Provider, error: 0 - The target principal name is incorrect"

Here is the code snippet and configuration details in this case.

DbConnectionStringBuilder connectionstring = new DbConnectionStringBuilder();

            connectionstring["Data source"] = "myserver";
            connectionstring["integrated Security"] = false;
            connectionstring["Initial Catalog"] = "testDB";
            connectionstring["Encrypt"] = "True";
            connectionstring["TrustServerCertificate"] = "False";
            connectionstring["User ID"] = "sa";
            connectionstring["Password"] = "sa";

            SqlConnection con = new SqlConnection(connectionstring.ConnectionString);
            try
            {
                con.Open();
            }
            catch(Exception ex)
            {
                string msg = ex.Message;
                label1.Text = "Failed";
                return;
            }

Can somebody please help me resolving this issue. I am totally stuck here.

Thanks a lot.

OLE DB connection error; provider becomes unavailable to Linked Server

$
0
0

We have a SQL2005 server install running on a Win2003 Server.  It has a linked server to iHistorian using the iHOLEDB provider for iHistorian. Randomly and after a few execution to this provider, we start getting errors

Msg 7303, Level 16, State 1, Line 2

Cannot initialize the data source object of OLE DB provider "IhOLEDB.iHistorian" for linked server "fspheafhs1".

I created a data source in VS2005 for BI on the SQL server using the iholedb provider.  This was successful.  However, all queries or OPENQUERY statements to the linked server fail.  This seems to continue until SQL Server is restarted. Does anyone know how to reset a provider in SQL Server or tell if the SQL Server is having trouble with the provider?  There are no message in the SQL Error Log. Again the provider continues to work outside of SQL Server, but no longer can be accessed from within SQL Server. Thanks in advance.
Viewing all 4164 articles
Browse latest View live


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