SQL Server Native Connection not actually connecting as expected - pentaho

I'm working in an environment where I have to connect to an app server using a CyberArk account and once logged in, I can access the Pentaho Data Integrator tool.
From within this tool, I created a connection to the database server using SQL Server Native. When I test the connection, it connects successfully. A simple SQL Script step query "Select x from table y" provides accurate results. When I create a SQL Script step and test the user account, "select suser_name()" it returns the account used to login to the Pentaho server via CyberArk, not the configured account used in the connection object. Because of this, I can't execute stored procedures created specifically for the account used in the connection object.
Is there a configuration for Pentaho that I'm missing?

Related

Can I link a server that I only have read-access to?

Trying to link a server that I only have read-access to and uses windows authentication to log me in. I'm trying to link it to my local database so I can combine commands in both databases because my web application executes stored procedures.
Is this possible?
https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql?view=sql-server-2017
Yes, you can.
From your description, you want to uses windows authentication to log in the linked server.
When a linked server is created by using sp_addlinkedserver, a default self-mapping is added for all local logins. As a result, if the windows account for the local server also exist in the remote account, you can log in the linked server via the current windows account.
Besides after adding the linked server, you can also create a mapping between a login on the local instance of SQL Server and a security account on a remote server. For detailed information, please refer to the sp_addlinkedsrvlogin (Transact-SQL).

how to create a linked server to a SharePoint site in SQL Server 2014

I keep reading articles online that say this is possible but nothing that says how to do it. I have an SQL Server 2014 server and I want to create a linked server to a SharePoint site. I can go to Server Objects > Linked Server > New but then I don't know what to do.
Follow the steps below:
1.Open SQL Server Management Studio, enter the name of your local SQL Server, and then select Connect.
2.Expand Server Objects, right-click Linked Servers, and then select New Linked Server. To see Server Objects, connect to a local on-premises SQL Server. Then, Server Objects should be displayed.
3.In the Linked server text box, enter the full network name of the SQL Server you want to link to.
4.Under Server type, select SQL Server.
5.In the left pane, select Security. In this step, you map the local account you created to the remote server login.
6.Select Add, and enter the following:
a.Under Local Login, select the local account you created.
b.Check Impersonate if the local login also exists on the remote server.
c.Alternatively, if the local login will be mapped to a remote SQL Server login you, enter the Remote User name and Remote Password for the remote server login.
7.In the left pane, choose Server Options. Set the RPC and RPC Out parameters to True, and then select OK.
Articles:
https://learn.microsoft.com/en-us/biztalk/core/how-to-create-a-linked-server
https://learn.microsoft.com/en-us/sql/relational-databases/linked-servers/create-linked-servers-sql-server-database-engine
If you want to access SharePoint data from other application, I suggest you use SharePoint API(CSOM(C#), REST API or web service) to achieve it.
Complete basic operations using SharePoint client library code
Complete basic operations using SharePoint REST endpoints

Issue deploying SQL Server database from local machine to SQL Azure

I have a database I've created on my local machine that I can't seem to correctly deploy to SQL Azure. I'm deploying two databases, including the one that provides user membership.
Every time I attempt this, when I try to login and access to the database is attempted, I receive a The system cannot find the file specified error:
I've tried deploying the database every way I could from Microsoft SQL Management Studio - by right clicking my databases and "Deploy Database to SQL Azure", by generating drop and create data only SQL scripts and running these against an existing target database, by creating a bacpac and importing this and all of these have the same result.
I've double checked connection strings in my .NET MVC applications web.config and these are all correct.
Interestingly, if I run my website locally with connection strings that pointed to my updated Azure SQL db, everything works fine - but on my Azure Website I always get the same results.
Your issue actually looks like a connection string issue but if anyone else ends up here thanks to Google you can resolve orphaned users on Azure SQL Db using:
ALTER USER <user_name> WITH Login = <login_name>;
I am not a AZURE expert, but when moving DB's from one server to another sometimes user's get orphaned making the DB not accessible.
Can you run this command on the AZURE DB via SQL MANAGEMENT STUDIO?
exec sp_change_users_login 'Report'
It will tell you what username and UserSSID may be orphaned. If indeed there is a returned record run
EXEC sp_change_users_login 'Auto_Fix', '[[UserName_goes_here]]'

SQL Server 2008 database Publishing Wizard

I'm trying to run a database import using the Copy Database Wizard Tool from SQL Server Management Studio in SQL Server 2008.
I have connected to my database using the sa account and when I run the process I used the sa account on both the source and destination database.
All the processes are failing with
Event 18556, Login failed for user '{domain}\administrator'.
Reason: Failed to open the explicitly specified database. [CLIENT: ]
The SA account should have sufficient rights to import the database and the administrator account definitely has the rights.
So, the first question is, why is the administrator account even mentioned since everything is run as SA?
The second question is, why is the administrators account failing to open the explicitly specified database, when that account has total control of all databases on the destination server?
Finally, what exactly is the specified database? There is data in the binary portion of "event log" that points to Master but no mention of the database anywhere else.
Are you connecting to SSMS using pass through authentication? Your wizard will run as your user I believe if so. Connect to your database server in SSMS using the sa account and then try launching it.
Give it a valid account to the other database, sa needs access locally, the 2nd account needs access on your other SQL server.
Alternatively, make sure your domain user has access to the database in question (not the server, the db is dif.) and run it that way.
The master db is where all the sys tables reside, it's the overlord db so to say: http://msdn.microsoft.com/en-us/library/ms187837.aspx

Unable to use vbscript to connect to sql server on different domain

I'm using vbscript to try to connect to a sql server on another domain. The server is part of a cluster and is SQL Server Data Center Edition (64bit). I can ping the server from my machine. I'm using the IP address to connect which works fine on SSMS.
The vbscript code I'm using is:
Set cn = CreateObject("ADODB.Connection")
cn.Open "DRIVER={SQL Server};Server=123.456.345.567\instance;Database=MyDB;User
ID=domain\myuserid;Password=mypass;"
strCommandText = "Select * from mytable"
cn.Execute strCommandText
When I run this, I get the following error:
Microsoft OLE DB Provider for
ODBC Drivers: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'domain\myuserid'.
I can't join my test machine to the domain and I can't use sql authentication as it's disabled on the sql server.
What do I need to do to get this to work?
Looking at you query string I see you are specifying username and password, and that means you are providing SQL Authentication credentials. However in your question you state SQL Authentication is disabled in the SQL server.
That's the reason why your SQL server is not letting you in. You are providing SQL authentication credentials when your server is not expecting them.
If SQL Authentication is disabled, then is very likely your server is not in Mixed Mode Authentication either so that pretty much means the SQL server is using Windows Authentication for logins. This configuration is beyond your control, it's your DBA who made that choice.
Therefore, if the SQL server you are connecting to is using Windows Authentication mode, your query string should be:
cn.Open "DRIVER={SQL Server};Server=123.456.345.567\instance;Database=MyDB;Trusted_Connection=yes;"
However here comes the tricky part... if you are running your VBScript from your test machine that is part of [DOMAIN_A], it will run with under a [DOMAIN_A] windows credentials. However your SQL server is expecting windows credentials from the domain he is joined into. Let's call it [Domain_B].
Unless you AD admins have created trust relationship between [DOMAIN_A] and [DOMAIN_B] your login attempts will still fail, despite now having a correct query string.
How do you solve this cross-domain issue if you canĀ“t join your test machine to [DOMAIN_B]? Easy. Use the "Runas" command.
On your test machine joined to [DOMAIN_A], open a command prompt and execute:
Runas /noprofile /netonly user:[DOMAIN_B]\myuserid %comspec%
It will ask you for the password. Enter the "mypass" password you originally had in your query string. "myuserid" is also the username in your original query string.
After doing that, you will have a new command prompt window, but if you notice in its title, it is now running under your [DOMAIN_B] credentials.
Despite still being on your test machine joined to [DOMAIN_A], anything that you execute on this new command prompt will do it under your [DOMAIN_B] credentials. Exactly what your SQL server is expecting.
So at this point, only thing left is to run your VBScript on this new command prompt window. That should provide the appropriate credentials to SQL server.
Let us know if that solved the issue.
To my knowledge, there isn't an option to connect without joining the domain or using SQL Authentication. You might have luck connecting through a VPN in which you virtually join a domain.
Try changing your connection string, specifically driver to provider:
Give a try this one
Provider=SQLNCLI10;Server=myServerAddress;Database=myDataBase;Uid=myUsername;
Pwd=myPassword;
Here are conenction string examples:
http://www.connectionstrings.com/sql-server-2005#sql-server-native-client-10-0-oledb-provider