Hi All,
I have been trying out to connect to MySql db which is in localhost and which can be in a VM
so Finally i found out how to do this so though of sharing this Knowledge which might help developer who wants to do this.
Prerequisites :
- Mysql DB setup in either local machine or in VM MYSQL-SOFTWARE
- MySql ODBC connector to connect UiPath to DB MySql-Connector install 32bit version since it works without any issue when i tried.
- Once both are installed firstly create a db which you needs to access.
- Then open ODBC Data source administrator software [win + search odbc ]then add new user DSN
in the new window select MYSQL ODBC ANSI Driver → click finish
then add data source name as you want.
Method 1 : For Localhost DB :
then for localhost add localhost as server url and leave the port as it is.
Method 2 : For DB present in VM:
then for VM DB add VM url as server url and leave the port as it is.
then add mysql db username and pwd which you have mentioned while creating mysql db.
then add db name which you want to access.
now you can check the DB connection by pressing test button next to DB. if everything is fine this will give you success.
Once the above steps are success then create a Work flow in uipath studio with connect activty in it.
And click on configure connection button → click Connection wizard → Select other in data source → select .NET FRAMEWORK DATA PROVIDER for ODBC in Data provider column. → click ok .
as shown below
Then in next window select data source which you created earlier and provide username and pwd of your db.
once done test connection by clicking on Test connection button if everything is fine it will give success.
Next save the connection in a variable as show which you can use later to execute sql queries.
then pass this connection string in the execute query activity
then save the result table in a variable. which you can write in to an excel file.
use the same table write to an excel as shown below.
attaching wf as well.
db.xaml (8.3 KB)
I hope it helps .
Regards