How do I connect to serverside DB like SQLite in UIPath? - sqlite

I am trying to connect to a SQLiteDB that is on my computer. But could easily be on my workstation. I have created a DNS for it in ODBC with a downloaded driver but I'm stuck on how I can connect to this DB in UIPath.

Drag the Database > Connect activity into your sequence or flowchart
Click on “Configure Settings” and then connection wizard
Select for Data Source and “.Net Framework provider for ODBC” for Data Provider
Click OK
Select the ODBC DSN name
If the database requires a user/password, enter that too.
Then click on test connection, should get a pop up that says "Test Connection succeeded"
What it will output is a Database Connection.
While the focus is on the database connection Activity, go to the output section and in the Database Connection, create the variable (Control K) and name the variable.
From here, you can use the connection and other database activities to manipulate it

Related

SQL Server 2017 ODBC via Rstudio or R on SSMS gets connected only to master database

I have been working on SQL Server 2017 via R (on Rstudio as well as R on SSMS) and i am unable to connect to a specific database. I mention the database name in the connection prompt but, it gets connected only to the master database. Is there something that I am missing while connecting?
The syntax I use for connection is:
conn = "Driver={ODBC Driver 13 for SQL Server};server=;Uid=uid; pwd=pwd;Database = mydb"
I am trying to use both RevoscaleR as well as ODBC() package in Rstudio to connect to a specific database but, it still gets connected to master database. Using RStudio connections pane, if i try to explore the other databases, it shows only dbo schemas and no other schemas even if they exist. Can someone help me in figuring out what might have gone wrong?
Most likely the login you use (the uid) is not authorized for that particular database (it is not created as a user in that database).
Some example code you can run in SSMS as - for example - sa:
--switch over to the database in question
USE mydb
GO
CREATE USER uid FOR LOGIN uid;
The above code creates a user in the database in question with the same name as the login.
Hope this helps!

SQL works in R studio but not in R-Serivces

This code works perfectly in R-Studio but there is no way to make it work in MS Management studio. It keeps on saying that:
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'myserver\LOCAL01'.
That is not my user give it is a trusted connection. Can someone help me understand it?
ALTER PROCEDURE [dbo].[TESTIM] AS
BEGIN
SET LANGUAGE ENGLISH
CHECKPOINT 
DBCC DROPCLEANBUFFERS
EXEC sp_execute_external_script
#language = N'R'
, #script = N'
con <- "Server=myserver\\LOCAL;Database=mydb;Trusted_Connection=true";
sql <- RxInSqlServer(connectionString = con, shareDir = "c:\\TMP");
local <- RxLocalSeq(sql);
rxSetComputeContext(local)
ff <- RxSqlServerData(sqlQuery = "select top 1 * from mytable", connectionString = con);
t = rxImport(ff);
OutputDataSet <- data.frame(SUCCESS = TRUE);
'
WITH RESULT SETS (([SUCCESS] BIT))
END
So, when you execute sp_execute_external_script it executes under one of 20 Windows user accounts (worker accounts) that has been created during installation of SQL Server R Services. These accounts are created for the purpose of running tasks under a security token belonging to the SQL Server Trusted Launchpad service.
This works very well, but if you need to create a SQL connection inside your R script (as in your case) and you use trusted connection (Windows Authentication), you are executing under the user account mentioned above ('myserver\LOCAL01' in your case), and that account need to be given permission to log in to the SQL Server instance on your behalf.
To do this:
In SQL Server Management Studio, in Object Explorer, expand Security, right-click Logins, and select New Login.
In the Login - New dialog box, click Search.
Click Object Types and select Groups. Deselect everything else.
In Enter the object name to select, type SQLRUserGroup and click Check Names.
The name of the local group associated with the instance's Launchpad service should resolve to something like instancename\SQLRUserGroup. Click OK.
By default, the login is assigned to the public role and has permission to connect to the database engine.
Click OK.
That should do it (the above steps are copied from here.
If you want to read more about the user accounts you can have a look at my blog-post "Microsoft SQL Server R Services - Internals III".
Hope this helps!
Niels

odbcDriverConnect issue trying to connect to an Access Database in R

I am using R 32 bit and am having an issue trying to get the odbcDriverConnect function to work when trying to connect to an Access database. I have successfully connect to the database using odbcConnect, but am also trying to learn how to use the odbcDriverConnect function.
My code is
scallopdata<-odbcDriverConnect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=S://adv/Scallop Central/2014 RSARR/2014 RSA Database_9_3_2014.mdb;
Uid=admin;Pwd=")
When I run the code, I get an error message of
ODBC Microsoft Access Driver Login Failed. Could not find file S://adv/Scallop Central/2014 RSARR/2014 RSA Database_9_3_2014.mdb.
I click the OK button which takes me to a Login box. I select the Database... button. This brings me to a Select Database box where I can select the same database that is specified in the Dbq section of code. Once I select the correct database and click OK I am connected to the database.
I am hoping to use the odbcDriverConnect function so that I do not have to set up a new odbc DSN for each database I would like to access. This may just be me not fully understanding the function.
If any one can provide so insight, it would be very helpful.

What is the Data Source syntax SQL Client Connection String to Azure?

I am attempting to configure the connection string in web.confg for an ASP.NET app to connect to Azure DB. I am new to this but am familiar with sql configuration strings to SQL Server. How do I configure the login and data source in the connection string I am building. I haven't ever dealt with the cloud like this. If my db name is DB1 how do I set the Azure path for the data source portion of the connection string. NOTE: I know where to configure it in web.config and know to create a connection object.
Thanks.
In the Azure portal, you can navigate to your database's dashboard and click 'Show connection strings' on the right side. See the first screenshot on the below tutorial:
http://azure.microsoft.com/en-us/documentation/articles/sql-database-dotnet-how-to-use/
To answer your original question, "Data Source" means the same as "Server", it is just your server name, i.e. blah.database.windows.net. All of the connection string keywords (including their synonyms) are documented here: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring%28v=vs.110%29.aspx

Connect to iSeries with OdbcConnection: password prompting

I want to connect to DB using the iSeries Client Access driver. I use the following connection string:
DRIVER=Client Access ODBC Driver (32-bit);QUERYTIMEOUT=0;PKG=QGPL/DEFAULT(IBM),2,0,1,0,512;LANGUAGEID=ENU;DFTPKGLIB=QGPL;DBQ=QGPL
XXXXXXXX;SYSTEM=XXX.XXXXXXX.XXX;Signon=2
I get an exception when connecting:
ERROR [28000] [IBM][iSeries Access ODBC Driver]Communication link failure. comm rc=8015 - CWBSY1006 - User ID is invalid, Password length = 0, Prompt Mode = Never
How can I make the application prompt the user for his credentials to the DB?
I presume that this is a desktop application and not a server application based on the wording of the application.
If you could make use of the ODBC setup within the ODBC Data Source Administrator, that can be set to use the default setup of iSeries access.
Otherwise, you might have to prompt for the username and password within the application then pass that into the connection string.
Here's a quick example of how to make an ODBC connection to an iSeries from Excel. It'll prompt for a username and password if it doesn't already have a connection. You'll need the iSeries Navigator (aka client access) ODBC driver installed on the client.
Dim DB2Con As New ADODB.Connection
DB2Con.Properties("Prompt") = adPromptComplete
DB2Con.Open "DRIVER=Client Access ODBC Driver (32-bit);SIGNON=1;SYSTEM = YOURSYSTEMNAME"

Resources