SSL/wallet error trying to access Oracle DB from SSRS - sql-server

I'm trying to access a third party Oracle database from SQL Server Reporting Services. I had it working on previous versions of SQL Server and Oracle ODAC, but it's been several years. I'm now being forced into an upgrade, and when I try to create the data source in SSRS, I get the following error:
Network Transport: SSL failure in parsing wallet location
I created an ODBC connection and am able to successfully test the connection, so I know all of the settings in tnsnames.ora and sqlnet.ora are correct. I know SSRS is looking at the correct files because I can get a different error by changing the connect identifier to something made up. The wallet is in a sub-directory of the tnsnames file. I have tried placing the wallet location in both files, but no combination seems to work.
tnsnames.ora
<Connect Identifier> =
(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCPS)(HOST = <host>)(PORT = <port>)))
(CONNECT_DATA = (SID = <SID>)(SERVER = DEDICATED))
(SECURITY = (MY_WALLET_DIRECTORY = D:\Oracle\wallet))
)
sqlnet.ora
WALLET_LOCATION= (SOURCE=
(METHOD=file)
(METHOD_DATA=(DIRECTORY=D:\Oracle\wallet)))
Current configuration
Windows Server 2016
Microsoft SQL Server 2016
64-bit ODAC 12.2c

The take away to solving this problem is each time you change the SQLORA.NET file you have to restart the SRSS Windows Service.

Related

Polybase external data source using ODBC, login failed error

Using SQL Server 2019 Enterprise Edition (CU14)
I am attempting to use Polybase for reading data from a simple CSV text file.
When executing the create external data source I get the error "Msg 46721, Level 20, State 1 Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication."
The statement I'm using is:
create external data source datasourcename
with (
location = 'odbc:\\localhost',
connection_options='Driver=Microsoft Access Text Driver (*.txt, *.csv); Dbq=d:\data\; ApplicationIntent=ReadOnly;',
pushdown=off,
credential = <credential name> -- < On DEV server it works both with/without this
);
This actually works on my development server, however on the production server it is throwing this error and I can't find a solution. Not really sure what is trying to be logged in to!
On the Dev server (also SQL server 2019/CU14) I can even leave off the credential option and it still works.
Both servers are using the same domain account for the SQL Server service and Polybase services, I have defined the credential identically as:
create database scoped credential <credential name> with identity = 'Sql Server service domain account', secret = 'domain account password';
I don't think it's relevant but the production server is an Availability-Group secondary replica where I'm trying a simple proof-of-concept to test reading a CSV file and inserting data into TempDB.
On both my Dev server and Production server the file I'm trying to read is located in a folder on a local drive. The drive & folder has full control permissions for the SQL Server Service account.
Both servers have the same odbc driver installed, version 16.00.4999.1000
I have tried adding "trusted_connection=Yes and No" to the connection_options.
Connecting with SSMS I have tried using my own domain account and the SQL Server sa account.
I have installing the "Kerberos Configuration Manager" and connecting to the production server to check the SPNs and it reports "status good".
I have tried adding "DisableLoopbackCheck" registry key on the server.
So far nothing has worked and I'm at a loss as to what else to try.
The external data source definition is wrong: use forward slashes, don't use localhost, the odbc string is missing the curly braces, application intent is not a property of the odbc, and you don't need a credential. See this link for an example: https://36chambers.wordpress.com/2022/02/21/polybase-versus-flat-files/

Connecting to SQL Server using PHP, ODBC, and Windows authentication

I'm trying to use PHP to connect to an ODBC data source using Windows authentication. I can connect just fine to the server in SQL Server so I know it's running. When I try to run the command
$link = odbc_connect("my_odbc","","");
I get the error:
"Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Login failed for user ''., SQL state 28000 in SQLConnect in C:\Users..."
I tried:
$link = odbc_connect("Driver={ODBC Driver 11 for SQL Server};
Server='my_odbc';Integrated Security=SSPI","","");
Which returned the message:
Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. , SQL state 08001 in SQLConnect in C:\Users..."
Not sure what I'm doing wrong.
my_odbc is a SQL Server (2008) on a different machine. I don't have admin privileges on that database so I can't change anything on that end (such as enabling SQL Server authentication).
I am running Windows 7 and using PHP Version 5.6.12
phpinfo() indicates that ODBC Support is enabled as well as pdo_sqlsrv support
Maybe you should try PDO (the performance difference isn't that great) with SQLsrv plugin (this what I'm using to connect to my other boss' software which use SQL Server 2008 database):
$connection = new PDO("sqlsrv:Server=" . $this->sourceServer . ";Database=" . $this->sourceDB, $this->sourceUser, $this->sourcePW);
$connection->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
You can download the plugin here
https://www.microsoft.com/en-ca/download/details.aspx?id=36434
In Xampp, you must copy the dll in that folder:
C:\xampp\php\ext
And you must add that line to your php.ini
extension = php_pdo_sqlsrv_56_ts.dll
Note: Don't forget to restart your server so it can take in account the new php.ini file.
Let me know if it works for you
This error is a General Error that arises due to unable to establish connect to the server for some reasons. Its important to know what server are you using with PHP and the application used with it. Example Apache, Xampp or Wamp etc.
Here are somethings you could try like.
Let me brief, below are the reference links.
Check whether it pings
Enable TCP/IP connection SQL Server Configuration if not enabled. To do so, Open SQL Server Configuration Manager -> SQL Server Network
Configuration->Protocols for SQL server->TCP/IP(set to enabled).
Restart SQL services.
Enable Remote Connection from server
Open the Port, To do so Windows Firewall Settings-> Exceptions -> add a Port (Name:SQL;Port:1433;TCP) then from Exceptions tick SQL and save.
Enable running browser services.SQL Server Configuration Manager -> SQL Server Services - > SQL Server Browser set to running.
defining Port in connection string
add instance name with machine name if more than one instance is being used
sample
$user = 'username';
$pass = 'password';
//Use the machine name and instance if multiple instances are used
$server = 'serverName\instanceName';
//Define Port
$port='Port=1433';
$database = 'database';
$connection_string = "DRIVER={ODBC Driver 11 for SQL Server};SERVER=$server;$port;DATABASE=$database";
$conn = odbc_connect($connection_string,$user,$pass);
here are useful links that i found regarding the issue
resolving could not open a connection to sql server-errors
sql server provider named pipes provider error
Have a look at these links too
Named Pipes Provider: Could not open a connection to SQL Server [53]
Someone had the same error message and asked and answered his own question here.
To quote...
I´m sorry for the troubles.
The problem was, that I was using SQL Server Native Client 11.0 as driver. I switched it to SQL Server and now it works :/
Hopefully this at least helps someone, being in a similar problem....
A significant omission from your question is how you are running PHP and with which credentials.
Assuming you are using IIS or Apache (or another web server), then your PHP process is probably running under the local system account:
Since this account is local it doesn't have any authorisation to access your remote SQL Server.
You could alter the IIS/Apache service to run with the credentials (yours?) that are authorised to connect to SQL Server, but be aware this might cause other permissions issues with the service as well as being a problem if you change your password in the future.
Try running a test script from the command line (which should run with your credentials by default) to determine where the problem is:
php -r "var_dump(odbc_connect(...));"
Look at the regedit HKLM/SOFTWARE/ODBC
what is your folder name ?
If there is a "SQL Server Native Client 11.0" then you have to write your php code like
odbc_connect("Driver={SQL Server Native Client 11.0};Server=ip;Database=db;", "user", "pass");
However some of the server like server 2008 will be record this odbc like
ODBC Driver 11 for SQL Server
Then you have to replace SQL Server Native Client 11.0 by ODBC Driver 11 for SQL Server.
You have to create an ODBC interface first. In principle, this should also work without a user and pw. If defined in interface.
$pdo = new PDO('odbc:dsnName','user','pw');
Enable in IIS on Manager PHP o PDO_ODBC:
I have authenticated by Windows with following PHP statement:
$ Conn = new PDO ("odbc: Driver = {SQL Server}; Server = JAMILI-PC \ SQLEXPRESS; null; null");
I am using Windows 2008.
I hope it solves your problem.

Cross Server script execution oracle

I am having DB server on another machine and having asp.net application installed on local machine.
I want to connect remote DB and execute my scripts, since my local machine doesn't have oracle installed
I have go-ogled and tried few links it tells me editing transnames.ora file adding one new entry
But this will not work since my local machine doesnt contain sqlplus
So I would like to now what are the tools I will need to download on local application server to run my scripts.
You need to install oracle driver to communicate with remote server.
There are multiply options:
This 2 will have tnsnames.ora file that you we told about:
Full oracle client
Oracle instant client (small in size)
Tool specific:
oracle jdbc driver for java
cx_oracle for python
something else for other tool
OS specific:
on windows you can setup an ODBC driver to connect to ORACLE
Thanks abhi, filename is corrected.
After installing a client, you need to know where is your database server.
In simple situation you need host, port and sid.
entries in tnsnames.ora look like this:
connectionName =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = yourHost)
(Port = yourPort)
)
)
(CONNECT_DATA =
(SID = yourSID)
)
)
You fill in all information and save the file.
after that you can check connection ( I don't know, if tnsping is shipped with instant client)
>tnsping connectionName
OK (description of a connection)
Useful tip: you can just go to remote server (or some other PC that have db access already configured) and tnsping some connection (you probably already have a standard name for it).
than just grap the output in brackets and put it into your tnsnames.ora.
your connection string:
username/password#connectionname
btw, instead of conenctionname you could put the whole connection descriptions (from tnsnames.ora)
username/password#(description=...)
Now you can use the Oracle Managed Driver which does not require the installation of the Oracle Client on the machine. This is extremely helpful as Oracle Client installations are painful. It requires nothing more than putting the driver in your bin directory and providing an appropriate connection string and provider name.
To install the managed driver via NuGet run...
Install-Package odp.net.managed
You may need to change the provider name (I believe it's Oracle.ManagedDataAccess off the top of my head).
Example connection string...(replace MyHost, MyPort (usually 1521), MyOracleSid, myUsername, and myPassword with appropriate info).
SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));
uid=myUsername;pwd=myPassword;

failed to retrieve data for this request - listing SQL Servers with SMO

DataTable dataTable = SmoApplication.EnumAvailableSqlServers(false);
comboBox1.ValueMember = "Name";
comboBox1.DataSource = dataTable;
i am trying to populate a combobox control with a list of SQL Servers available on the company network with the above code but am getting the error below.
failed to retrieve data for this request
the code works on the development machine but fails on a client PC that has even has SQL Server 2012 Shared Management Objects installed.
Enumeration is subject to SQL Server Browser Service being enabled on the target(s) (by default is disabled) and is subject to on-site specific subnet UDP broadcast restrictions. In other words is extremely unreliable. If you want to discover SQL Server installations you should either have an administrator provide a list of servers or use WMI and the AD database.

Database Links - Oracle 10g and Ms Access 2007

I'm trying to create a link between oracle 10g and ms access 2007 but I don't know how to set parameters in my tnsnames.ora file to access my MS Access db.
I've created new Data Source in ODBC Data Source Administrator with Microsoft Access Driver and selected my access db (.mdb).
In the MS Access I can link between tables and I see data from my Oracle db, but I need to create a database link from Toad or SqlDeveloper so I can change data in MS Access db with some trigger in my Oracle db. When I try to test my db link I get the following error :
Error : ORA-12154: TNS:could not resolve the connect identifier specified, because I don't know what parameters I need to write into my tnsnames.ora file. MS Access db is located on my hard drive. Here is how my tnsnames.ora looks like :
accdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost) (PORT = 3306)
)
(CONNECT_DATA =
(SID = hsodbc)
(HS=OK)
)
but I'm not sure for PORT and SID.
Any help?
This article shows how Oracle's Heterogeneous Services can be configured to allow a database to connect to a Microsoft Access database using standard databases links:
http://www.orafaq.com/node/60
Try this as a starting point
http://download.oracle.com/docs/html/B10544_01/ch2.htm#1005725

Resources