Tutorial on MYSQL connection on Localhost or remote VM

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 :

  1. Mysql DB setup in either local machine or in VM MYSQL-SOFTWARE
  2. MySql ODBC connector to connect UiPath to DB MySql-Connector install 32bit version since it works without any issue when i tried.
  3. Once both are installed firstly create a db which you needs to access.
  4. 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
image
Then in next window select data source which you created earlier and provide username and pwd of your db.

image

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.

image

then pass this connection string in the execute query activity

image

then save the result table in a variable. which you can write in to an excel file.

image

use the same table write to an excel as shown below.

image

attaching wf as well.
db.xaml (8.3 KB)

I hope it helps .

Regards

16 Likes

Hi, I want to ask where to find connect activity?do I need to download package?

Hi @Liwq

You should install this activity package:

ok, thanks very much!

image
Sir, I am not getting any option here. can you help sir.

Thank you

I have installed MySQL and working in MySQL Workbench 8.0 CE. Do i want to install MySQL Connector/ODBC or not necessary ???

odbc 32bit is required and also install uipath.database.activities

Ya i have installed that, but in service name of connect activity, the drop down is empty. What should i do? @manoj2500

try installing Connector/ODBC 32-bit,
it worked for me after uninstalling 64-bit and installed 32-bit.

1 Like

Hi @in2ute,

That is great tutorial! I want to know which operating system did you achieve this?
Because I could not manage connection at Windows Server 2008. No problem in my local Windows 10 Pro.

Thanks,

Awesome post @in2ute

It made my day :smiley:

if i cant use odbc?

설명대로 설정을 진행 중인데 이미지와 같은 오류가 있습니다.

이유를 알 수 있을까요?

20220719_006

Hello Sir,
I’m Getting an error at test connection. I have attached image pleas


e check and help me with the issue

try installing Connector/ODBC 32-bit,
it worked for me after uninstalling 64-bit and installed 32-bit.