SAS dsn to SQL server - sql-server

I was given below instruction by IT team to connect SAS to a SQL server db.
libname aa sqlsvr dsn=dms user=xx pass='yy' owner=dbo readbuff=30000;
libname aa slibref=aa server=host1 port
When I run this, I get:
ERROR: The SQLSVR engine cannot be found.
ERROR: Error in the LIBNAME statement.
ERROR: Attempt to connect to server host1 failed.
ERROR: A communication subsystem partner link setup request failure has occurred.
ERROR: Cannot find TCP service 'host1'.
ERROR: Error in the LIBNAME statement.
I tried setting up an ODBC connection using host1 as server name, but it says Server does not exist.
What did I do wrong

It is likely that you haven't set up sqlsvr as a DSN in windows yet.
From the Start menu, find your ODBC Data Source Administrator menu item. This differs depending on what version of windows you are running, but there's a good chance you can just click Start and type 'odbc' and it will show up. You will most likely want the 64-bit version of the ODBC Administrator, if you're having troubles you can try the 32-bit version.
Once open, go to System DSN, click on Add, Choose the SQL Server driver from the list, and fill out the rest of the details in the wizard. At the end of the wizard you will have the option to test the configuration. You must be able to connect successfully with this connection prior to being able to use the dsn= statement in SAS. Once the connection is successfully setup, the dsn= statement should work fine.
Your second statement with host1 and port is not a connection to SQL server, as SQL server doesn't use ports in their ODBC connection specifications. It also looks incomplete as you have it typed there so you may want to double check the code you were provided with.

Related

Unable to connect to another connection in SSAS Tabular

I have a very weird issue with SSAS Tabular connecting to a SQL Server source database. I've spent almost the entire day on this, and searched online in various ways to find a helpful answer, but none of the suggestions solved this mysterious problem for me.
It used to work fine, but I tried various connection settings (Windows vs SQL authentication, and different impersonation modes), but now I no longer can get it to work (even if I revert back to the previous bim file in source control).
When I process a table from the WORKSPACE database (through SSMS), it works. But when I process a table from the DEPLOYED database (still through SSMS), it does NOT work.
The connection I am using is:
-SQL Server Native Client 11.0
-Windows Authentication
-Impersonation mode of a Windows account (which has the appropriate permissions)
The source database is in a SQL Server database located on a different server (but in the same network).
I have searched everywhere online, but didn't find anything that could help me.
I have tried changing the connection driver (OLE DB Provider for SQL Server), and I have restarted the SSAS Tabular service.
The full error message I get when trying to process a table on the deployed database is:
Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: Login timeout expired; HYT00; 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; Named Pipes Provider: Could not open a connection to SQL Server [5]. ; 08001.
A connection could not be made to the data source with the Name of 'DataWarehouse'.
'.
In fact, after I tried a second time to restart the SSAS Tabular service, the error message I get after attempting to process a table is slightly different:
Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: 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; SSL Provider: The requested security package does not exist
; 08001; Client unable to establish connection; 08001; Encryption not supported on the client.; 08001.
A connection could not be made to the data source with the Name of 'DataWarehouse'.
'.
According to your description, it seems to be related to connection problem. You need to check whether corresponding SQL server service and SSAS Service is running(check server which contains "DataWarehouse" is running and can be connected). You could go to "SQL Server Configuration Manager " to restart them.
In addition, you also need to make sure your current windows credential can access this database(if you use window credential). And check whether this server enable remote connect.
Zoe

Microstrategy 10.4 SQL ODBC Connection error

I've tried to connect an SQL database from a server with Microstrategy located in another server through an ODBC connector for SQL.
First I've checked that there is a connection between the two servers executing a ping sentence with the IP Address the other server and it went through.
After making sure the connection is stablished without issues, I've tried to connect through Microstrategy without success. The error I get is the following message:
"Connection test error: Connect failed. Error type Odbc error. Odbc operation attempted: SQLDriverConnect (08001:0: on SQLHANDLE)"
Using SQL Server 2017 for the databases and Microstrategy 10.4.
Please, anybody has any clue about what might be happening?
Thanks,
look at the type of connector to the db you have. It gave me the same error until I used: "with Native Client Driver".
Could you please share the complete error message, SQL Handle error are associated with multiple error scenarios like invalid username * password, connecting 64 bit server with 32 bit ODBC driver etc. Complete error message would help me to debug it.
In general follow the steps to debug the error, (any order)
Check the version of ODBC Connection (64bit / 32 bit), it should be the same as server version.
Try testing the ODBC connection that you have created using ODBC Administrator tools to see whether there is an problem with username & password/server name or database connection issue.
Check the Database Instance/Database Connection/User Login created under the Administration option to ensure everything is working and give the correct value.
if nothing works try using the native driver given by MicroStrategy, you can access this using Connectivity Wizard.
Hope it helps..

Database connection in Pentaho Report Designer with MS SQL server 2008

While making a database connection in pentaho report designer using JDBC, I am getting the following error :
Error connecting to database [database_name] : org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Error connecting to database: (using class net.sourceforge.jtds.jdbc.Driver)
Network error IOException: Permission denied: connect
org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
I can't comment unfortunately, and without more information my answer will be a shot in the dark, therefore I will attempt to describe the perfect connection that you can use to connect to SQL Server 2008 via JTDS.
Put the jar that came with the JTDS package here: pentaho\report-designer\lib\jdbc.
If you wish to take advantage of the Windows Authentication, also grab the ntmlauth.dll file and put it in either System32 (for 64 bit Windows) or SysWOW64 (for 32 bit Windows, that's up to your configuration*). Fire up report designer.
New database connection:
Give it a connection name.
Set connection type to MS SQL Server, Native JDBC connection. The "MS
SQL Server(Native)" connection did not work for me.
Host name: the server's name where the Database sits. Server1, for
example.
Database Name: Take a wild guess what this might be. Yup, here you
enter your database name. Northwind, for example.
Instance name: Instance name, if you have any. Not mandatory.
Port number: default SQL server port is 1433.
User name / password: define one that has access to the database.
Leave it blank if you listened to me earlier and put the .dll file in
the right directory to use Windows Authentication.
Rejoice.
IN CASE you ever need the connection string and driver for SQL server connection:
driver: net.sourceforge.jtds.jdbc.Driver
URL (or string): jdbc:jtds:sqlserver://HostName:1433/databaseName
*let's not get caught up on the obviously challenged naming convention. I know, I know.

Diagnosing Connection to SQL Server

I'm trying to create an ODBC connection to SQL Server, but when i do, i get error:
Connection failed:
SQLState: '01000'
SQL Server Error: 10060
[Microsoft][ODBC_SQL Server Driver][TCP/IP Sockets] COnnectionOpen (Connect()).
Connection failed:
SQLState: '08001'
SQL Server Error: 17
[Microsoft][ODBC_SQL Server Driver][TCP/IP Sockets] SQL Server does not exist or access denied.
Here's what I've tried:
not a firewall issue: tried with firewall on SQL Server turned off, and client turned off. Also able to telnet 1433 from client and that works fine.
not an access issue: I can login from many different computers, including the SQL Server itself using the account i'm using on client (using SQL Server authentication)
i can ping the hostname and IP address. (i've tried both)
The only thing i can think of is that the client computer is windows server 2003, and has various roles setup:
File Server
Application Server
Terminal Server
Domain Controller
DNS Server
I don't know why these services are setup, but for the time being i can't shut them off. Would it be any of these, and if so, is there a way to disable any of the aspects of them, that might be blocking SQL.
Any advise truly appreciated!
Found the issue. For some reason, even though SQL was not in use on the client, it was installed, and by going to All Programs -> Microsoft SQL Server -> Client Network Utility, i found that the protocal TCP/IP was using port 4717. I have no idea why that port was in use, and even further, i'm not sure why it would even matter - I was just setting up an odbc connection, and not using sql server (on the client) at all. Either way, I changed this to the typical port (1433), and like boom, ODBC connection works like charm!
Is it possible that the server in question has not been configured to use named pipes?
CAUSE
The most common reason that this connection attempt failed is
that this DSN or ODBC data source attempted to make a connection using
the TCP/IP sockets Net-Library, which is Dbmssocn.dll. Because the SQL
Server is not listening for incoming connections for TCP/IP sockets
clients, the connection fails. From ISQL/w, the second error message
stated above would be returned. The OS Error is 10061, and the
function call that failed was ConnectionOpen(connect()).
WORKAROUND
By default, SQL Server will listen for incoming connections
made by Named Pipes clients. Named Pipes is the default IPC mechanism
for clients to connect to a SQL Server version 4.2, 6.0, and 6.5
server. The Named Pipes DLL is Dbnmpntw.dll, and it should be located
in the Windows\System or Winnt\System32 directory. The TCP/IP sockets
netlib DLL is Dbmssocn.dll, and also should be in the Windows\System
or Winnt\System32 directory.The most common resolution to this problem
is to configure the client computer to connect using Named Pipes.
Configuring Named Pipes If the Microsoft Data Access Components (MDAC)
ODBC drivers have been installed on the computer, you can make this
change in the second step of the Create New Data Source wizard.
NOTE: You can download MDAC drivers from:
http://msdn2.microsoft.com/en-us/data/aa937730.aspx To configure the
client, start the Create New Data Source wizard, click the Client
Configuration button, and perform the following steps, based on the
version of the SQL Server ODBC driver you are using:
For SQL Server ODBC Driver version 3.50
Click the Net Library tab and use the drop down list box to set the
default network (Net Library) to Named Pipes.
On the Advanced tab, remove any advanced entries that reference the
server you are connecting to.
Click Done.
For SQL Server ODBC Driver version 3.70
In the Network Libraries section of the Edit Network Library Configuration
dialog box, select Named Pipes.
Click OK.
If you do not have the MDAC ODBC drivers installed, you can use the
SQL Server Client Configuration Utility tool to set the default
Net-Library to Named Pipes. You can install the client utilities from
the SQL Server CD from the i386 directory.
Source: http://support.microsoft.com/kb/195566
By default SQL Native Client seems to look for MSSQLSERVER instance. However, if you use SQLEXPRESS all connections through that will fail.
Very strange, but try installing your SQL Server with MSSQLSERVER instance name - it should work!
To create a new Data source to SQL Server, do the following steps:
In host computer/server go to Sql server management studio --> open Security Section on left hand --> right click on Login, select New Login and then create a new account for your database which you want to connect to.
Check the TCP/IP Protocol is Enable. go to All programs --> Microsoft SQL server 2008 --> Configuration Tools --> open Sql server configuration manager. On the left hand select client protocols (based on your operating system 32/64 bit). On the right hand, check TCP/IP Protocol be Enabled.
In Remote computer/server, open Data source administrator. Control panel --> Administrative tools --> Data sources (ODBC).
In User DSN or System DSN , click Add button and select Sql Server driver and then press Finish.
Enter Name.
Enter Server, note that: if you want to enter host computer address, you should enter that`s IP address without "\\". eg. 192.168.1.5 and press Next.
Select With SQL Server authentication using a login ID and password entered by the user.
At the bellow enter your login ID and password which you created on first step. and then click Next.
If shown Database is your database, click Next and then Finish.
Adding another check point to all the above answers. Valid if you are using a named instance of Sql Server ( ServerName\InstanceName)
Make Sure UDP Port is enabled in Windows Firewall with SQL Server Default UDP Port
Number 1434. If not present create a new incoming rule in Firewall for UDP 1434 Port and restart SQL Server Browser Services in SQL configuration Manager.

Connection failed: SQLState: '01000' SQL Server Error: 10061 [duplicate]

This question already has answers here:
Enable remote connections for SQL Server Express 2012
(17 answers)
Closed 4 years ago.
I'm trying to connect my access front-end to the SQL Server backend.
It was working when SQL Server was on my computer but now i'm trying to connect to a server
So when I create the DSN file with access
I chose SQL-Server driver ( I have also tried with SQL-Server native 10.0 )
I enter the server name that I copied from SQL Management Studio so there's no typo there
I chose the NT authentication
Then I have this error
In the properties, I tried with TCP/IP with the default port 1433 and I also tried with the name pipes
I made sure that the checkbox to allow remote connection is checked
If I try to connect with management studio I got this error
I can see the server when I browse on the network
I'm trying this troubleshotting but i'm stuck with the telnet command. It says Could not open connection to host on 1433
I also tried with no port and i got the same error on port 23
Any ideas?
Thank you
To create a new Data source to SQL Server, do the following steps:
In host computer/server go to Sql server management studio --> open Security Section on left hand --> right click on Login, select New Login and then create a new account for your database which you want to connect to.
Check the TCP/IP Protocol is Enable. go to All programs --> Microsoft SQL server 2008 --> Configuration Tools --> open Sql server configuration manager. On the left hand select client protocols (based on your operating system 32/64 bit). On the right hand, check TCP/IP Protocol be Enabled.
In Remote computer/server, open Data source administrator. Control panel --> Administrative tools --> Data sources (ODBC).
In User DSN or System DSN , click Add button and select Sql Server driver and then press Finish.
Enter Name.
Enter Server, note that: if you want to enter host computer address, you should enter that`s IP address without "\\". eg. 192.168.1.5 and press Next.
Select With SQL Server authentication using a login ID and password entered by the user.
At the bellow enter your login ID and password which you created on first step. and then click Next.
If shown Database is your database, click Next and then Finish.
Windows firewall blocks the sql server. Even if you open the 1433 port from exceptions, in the client machine it sets the connection point to dynamic port. Add also the sql server to the exceptions.
"C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\Sqlservr.exe"
More info
This page helped me to solve the problem. Especially
or if you feel brave, locate the alias in the registry and delete it
there.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo\
I had the same error which was coming and dont need to worry about this error, just restart the server and restart the SQL services. This issue comes when there is low disk space issue and system will go into hung state and then the sql services will stop automatically.
Received SQLSTATE 01000 in the following error message below:
SQL Agent - Jobs Failed: The SQL Agent Job "LiteSpeed Backup Full" has failed with the message "The job failed. The Job was invoked by User X. The last step to run was step 1 (Step1). NOTE: Failed to notify via email. - Executed as user: X. LiteSpeed(R) for SQL Server Version 6.5.0.1460 Copyright 2011 Quest Software, Inc. [SQLSTATE 01000] (Message 1) LiteSpeed for SQL Server could not open backup file: (N:\BACKUP2\filename.BAK). The previous system message is the reason for the failure. [SQLSTATE 42000] (Error 60405). The step failed."
In my case this was related to permission on drive N following an SQL Server failover on an Active/Passive SQL cluster.
All SQL resources where failed over to the seconary resouce and back to the preferred node following maintenance. When the Quest LiteSpeed job then executed on the preferred node it was clear the previous permissions for SQL server user X had been lost on drive N and SQLSTATE 10100 was reported.
Simply added the permissions again to the backup destination drive and the issue was resolved.
Hope that helps someone.
Windows 2008 Enterprise
SQL Server 2008 Active/Passive cluster.

Resources