IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

Connect New SSRS Server to Old SQL Server with TLS

This was posted just to share an experience of tackling a problem we encountered when we needed to connect an SSRS Server 2016 to an older SQL Server database (Windows Server 2008 R2) and what steps we took to troubleshoot the issue.

After all the reports were migrated to the new SSRS server, upon creating a new Data Source, I got an error message something along the line to enter the user id and password correctly.

A simple way to check the connection to the SQL Server database is by setting up an ODBC connection to test.

Sure enough, even the ODBC Data Source Test failed with this message:

ODBC Data Source Administrator Test Failed

Microsoft SQL Server Login

Connection failed:
SQL State: '01000'
SQL Server Error: 1
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen
(SECCreateCredentials()).
Connection failed:
SQLState: '08001'
SQL Server Error: 18
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error

For the first issue, the resolution was because of the difference of TLS version enabled by default for each server. We know that TLS 1.2 is enabled by default on Windows Server 2016 or later. However, for the Windows 2008 R2 was not set up correctly.

Windows Server 2008 registry with no TLS enabled

No TLS enabled at all!

After following the steps to enable TLS 1.2 on Windows Server 2008, we retried the ODBC connection from the new SSRS server (Windows Server 2016) and it was successful.

ODBC Data Source Administrator Test Successful

With the ODBC connection working, we went back to check the connection from the SSRS itself (the same Windows 2016 Server). But when we clicked on Test connection, we still encountered the following error:

SSRS Data Source Connection SSL/Algorithm/TLS Error

Couldn't connect

The report server couldn't connect to the data source using the information you entered. Make sure you've entered the connection string and any credentials correctly.

Hide error details ^

  A connection was successfully established with the server, but then an error occured during the login process. (provider: SSL Provider, error: 0 - The client and server cannot communicate, because they do not possess a common algorithm.)

Logically, both servers should be able to communicate with each other using TLS 1.2 since both were enabled, but this could be caused by the weak cipher on the old Windows 2008. Since we were pressed on time and the client agreed with the temporary risk, the solution that we opted was to enable both TLS 1.0 and TLS 1.1 on both servers in addition to TLS 1.2.

Windows registry enable TLS 1.0, TLS 1.1 and TLS 1.2

Had these servers reside on the DMZ, we won’t recommend this solution at all. Even for internal servers such as our clients, we don’t recommend this solution as a long-term fix. But in this case, it was good enough.

This was remediated soon after when the client upgraded the database server to a Windows Server 2019, where TLS 1.2 is also enabled by default with strong ciphers being available.

Hopefully, it will help others who are also in the intermediary state of upgrading and trying to troubleshoot a similar issue.

With that, I welcome any input for a better solution (i.e., you have time to test that it only requires TLS 1.1 but not 1.0, or something more secure for that matter).

Further Reading

How to Enable TLS 1.2 as the Default Security Protocol on Windows Servers

January 17, 2022 Filed Under: Use Case Tagged With: Information Security, Microsoft, Microsoft SQL Server, SQL Server, SSRS

SSRS Doesn’t Render Reports in Chrome and Safari

Just earlier today I encountered an issue where SSRS reports that works fine in IE and FireFox were showing blank in Chrome and Safari and interestingly enough the common denominator for these two browsers are that they are based on WebKit.

Fortunately this is a known issue and someone already came up with a working solution by adding a javascript snippet in ReportingServices.js file under this directory (for default installation):

C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js

You can open up the file and copy & paste the code below:

ReportingServices.js

function pageLoad() {
	var element = document.getElementById("ctl31_ctl10");
	if (element) {
		element.style.overflow = "visible";
	}
}

Double check the element id. It is not always ctl31_ctl10.

Save the ReportingServices.js and close the text editor.

Refresh the browser and the report should be displayed properly now.

Further Reading

SSRS 2008 R2 reports are blank in Safari and Chrome

July 30, 2013 Filed Under: How To Tagged With: SSRS

A Quick Way to Hide TopBar Navigation Link in SSRS

This is just a quick hack to hide the breadcrumb and navigation links in SSRS.

SSRS TopBar Navigation Link

Under default installation, locate ReportingServices.css file under the following path:
C:\Program Files\Microsoft SQL Server\MSRS10_50\Reporting Services\ReportManager\Styles

This path is for SSRS version 2008 R2. If you use a different version of SSRS, then you need to replace the path MSRS10_50 to something else specific to whichever SSRS version you’re using.

Open the file with a text editor.

Find a css element called .topBar.

Just add display:none; after the open curly bracket on the first table.msrs-topBreadcrumb element under the .topBar.

table.msrs-topBreadCrumb { 
	display:none; 
	[leave the rest as is]... 
}

ReportingServices.css Customization

The final result would look like the screenshot below:
SSRS TopBar Navigation Link Hidden

Caveat

This only works if you want to hide the links but there’s no concern over the security of having the users accessing them. The links themselves can easily be seen from the page’s HTML source code.

July 29, 2013 Filed Under: How To Tagged With: SSRS

How to Create SSRS Report with Dynamic Query and Multi-Value Parameters

Continuing from the last SSRS tutorial on creating a SQL Server Reporting Services report with dynamic query and parameters, one caveat about the report is that it only works for one record search at a time.

While this may be fine for a customer who needs to search a particular record specific to the person, this is not generally useful for office use, where one person may need to search possibly hundreds or thousands of records that will be exported to an excel spreadsheet for further scrubbing and presentation.

We want to enable users to enter several search keywords and have the report rendered if any matched records.

In order to accomplish this, we need to modify the Parameters to allow multiple values. If we go to the left pane on the Report Designer and open the @SearchString Parameter Properties, under General tab, click on the Allow multiple values check box and click OK.

SSRS Multiple Values Parameter Checkbox

What this does is to change the Search for: text box to a drop-down list box to allow search based on multiple keywords. However, the report can still only search for one value. If we entered two values as in the example below, no records will be retrieved because the search keyword is actually a concatenated value of those two words separated by comma (i.e., ‘brown,baker’).

SSRS Multiple Values Search (Preview)

The concatenation is done using =Join(Parameters!SearchString.Value) built-in function. SSRS is smart enough to do this automatically when you selected Allow multiple values on the Parameter Properties. While the report is stored enough to concatenate the multiple values, the linked stored procedure still doesn’t know that it’s supposed to split the parameters into several individual values.

To do this, we need to create a user-defined function (UDF) that will split the concatenated parameters as a one column table.

Create a Split Function

CREATE FUNCTION dbo.ufnSplit (
  @Input NVARCHAR(MAX), 
  @Delimiter CHAR(1) = ','
)
RETURNS @Values TABLE (Item NVARCHAR(100))
AS
BEGIN
  DECLARE @Pos INT
  DECLARE @Single NVARCHAR(100)
  SELECT @Pos = 1 
  WHILE @Pos > 0
    BEGIN
      SELECT @Pos = CHARINDEX(@Delimiter, @Input)
      IF @Pos > 0
        SELECT @Single = LEFT(@Input, @Pos - 1)
      ELSE
        SELECT @Single = @Input
      INSERT  @Values(Item) VALUES (@Single)
      SELECT @Input = RIGHT(@Input, LEN(@Input) - @Pos)
      IF LEN(@Input) = 0 BREAK
    END
  RETURN
END 

Implement Split Function

Next, we implement the split function in the dbo.SearchEmployee stored procedure created in previous posting.

Modify stored procedure dbo.SearchEmployee by using ALTER PROCEDURE and replace the last line of the SQL statement from

= (@SearchString)

To

IN (SELECT Item FROM dbo.ufnSplit(@SearchString, ','))

The full SQL statement should look like this:

ALTER PROCEDURE dbo.SearchEmployees 
	@SearchBy NVARCHAR(MAX),
	@SearchString NVARCHAR(MAX)
AS
SELECT NationalIDNumber, FirstName, MiddleName, LastName,
       JobTitle, LoginID 
FROM HumanResources.Employee e
INNER JOIN Person.Person p
ON e.BusinessEntityID = p.BusinessEntityID
WHERE 
	CASE 
		WHEN @SearchBy = 'IDNo' THEN NationalIDNumber
		WHEN @SearchBy = 'Title' THEN JobTitle
		WHEN @SearchBy = 'First' THEN FirstName
		WHEN @SearchBy = 'Middle' THEN MiddleName
		WHEN @SearchBy = 'Last' THEN LastName
		WHEN @SearchBy = 'Login' THEN LoginID
	END
	IN (SELECT Item FROM dbo.ufnSplit(@SearchString, ','))

Execute the SQL to save the stored procedure (or press F5) and you’re done.

Once the stored procedure is modified, it will know how to parse the multi-value parameters and pass back the results as shown in the screenshot below.

SSRS Multiple Values Search

Please share this post if you find it helpful.

Futher Reading

Microsoft SQL Server 2012 Reporting Services (Developer Reference)
code-u-like: SSRS multi-value parameters with less fail
Passing multiple values for a single parameter in Reporting Services
User-Defined Functions
Using Parameters Collection References in Expressions (Reporting Services)
Single-Value and Multivalue Parameters (Report Builder and SSRS)

July 22, 2013 Filed Under: How To Tagged With: SQL, SSRS

How to Create SSRS Report with Dynamic Query and Parameters

Requirement: Produce an SSRS report the is searchable by the values of any fields in the report as shown below:

SSRS Report with parameter search

This type of report can be created using parameters input into a dynamic query in a stored procedure. We’ll use employee records from AdventureWorks database to demonstrate the report setup so it can be searchable by a search key and a search string as its value.

  1. Create Stored Procedure.

    CREATE PROCEDURE dbo.SearchEmployees 
      @SearchBy NVARCHAR(MAX),
      @SearchString NVARCHAR(MAX)
    AS
    SELECT NationalIDNumber, FirstName, MiddleName, LastName, 
         JobTitle, LoginID 
    FROM HumanResources.Employee e
    INNER JOIN Person.Person p
    ON e.BusinessEntityID = p.BusinessEntityID
    WHERE 
      CASE 
        WHEN @SearchBy = 'IDNo' THEN NationalIDNumber
        WHEN @SearchBy = 'Title' THEN JobTitle
        WHEN @SearchBy = 'First' THEN FirstName
        WHEN @SearchBy = 'Middle' THEN MiddleName
        WHEN @SearchBy = 'Last' THEN LastName
        WHEN @SearchBy = 'Login' THEN LoginID
      END 
      = (@SearchString)
    

    Stored Procedure search by parameters

  2. Test the stored procedure. Just to be sure the sproc works correctly, let’s do a test by executing it to search based on last name with a value “Brown.”

    EXEC dbo.SearchEmployees 'Last','Brown'
    

    And it should retrieve three records.
    Stored Procedure pass value

  3. Create a new report in Visual Studio (the assumption is that you already have a Report Server Project created and setup with Data Sources). On the left pane, right-click on Datasets and select Add Dataset…. Click on Stored Procedure on the Query type and select the procedure name created earlier from the drop-down list and click OK to close it.

    SSRS Setup Dataset

  4. Create report parameters. Right-click on Parameters on the Report Data window and click on Add Parameter… and the first parameter as below:

    Name: SearchBy
    Prompt: Search by:

    SSRS Add Parameter

  5. Go to Available Values and add all values you want end users to see and able to search from the report. These entries should match with the @SearchBy parameter in the stored procedure (SearchEmployees).

    SSRS Parameter Available Values

  6. Still on the same window, click on Default Values and check Specify values and pick any value from the drop-down list so we don’t get an error message that the parameter is blank.

    SSRS Parameter Default Value

    Click OK to close.

  7. Add a second parameter for the search string:

    Name: SearchString
    Prompt: Search for:

    Now, you should see two report parameters, @SearchBy and @SearchString. These two parameters still need to be linked to the dataset.

  8. Click on Datasets (dsEmployeeSearch) Parameters and set the names and values to the following:

    SSRS Parameter Name and Value in Dataset

  9. Setup the report as shown:

    SSRS Design View (Employee Search) Setup

That’s it. Once you’re done, click on the Preview tab and test it.

SSRS Report with parameter search

Caveat

While it’s nice to be able to search by any fields you want, it’s not too helpful because you can only search one record at a time. We will correct and enhance this report to accept multivalue parameters on the next SSRS tutorial, How to Create SSRS Report with Dynamic Query and Multi-Value Parameters.

Further Reading

Business Intelligence with SQL Server Reporting Services
Microsoft SQL Server 2012 Reporting Services (Developer Reference)

June 14, 2013 Filed Under: How To Tagged With: SQL, SSRS

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure