Connect Postgresql(remote virtual machine) with Uipath

Hello @UiPath_Community ,

Can any one help me to connect postgresql database with UiPath studio, where postgresql is on remote virtual machine. I have available the following:
host, username, password, DatabaseName.

@Subhamay_Maity1 Refer this post

I already gone through this post. But my sql server is on remote virtual machine.

It doesn’t matter where it is. Either you can connect to it or you can’t. If you can’t, then you need to find out from your network team how to connect to it.

Hi @Subhamay_Maity1

Certainly! To connect to a PostgreSQL database on a remote virtual machine from UiPath Studio, you can use the “Database” activities and provide the necessary connection details such as the host, username, password, and database name. Here are the steps:

  1. Install PostgreSQL ODBC Driver (If Not Installed):

    • If you haven’t already, you might need to install the PostgreSQL ODBC driver on your machine. You can download it from the official PostgreSQL website.
  2. Open UiPath Studio:

    • Launch UiPath Studio where you have your automation project.
  3. Install UiPath.Database.Activities Package:

    • If you haven’t already, make sure you have the UiPath.Database.Activities package installed. You can do this by going to Manage Packages and searching for “UiPath.Database.Activities.”
  4. Add a Database Connection Activity:

    • Drag and drop a “Database Connect” activity onto your workflow.
  5. Configure the Database Connection:

    • In the Properties panel for the “Database Connect” activity, you will see fields to configure the connection. Fill in the following information:
      • Connection String: You can use a connection string like this: "Server=your_host;Port=your_port;Database=your_database_name;User Id=your_username;Password=your_password;"
      • Replace your_host, your_port, your_database_name, your_username, and your_password with the actual values.
  6. Test the Connection:

    • Optionally, you can use a “Database Test Connection” activity to check if the connection is successful.
  7. Use Database Activities:

    • After establishing the connection, you can use various Database activities (e.g., Execute Query, Execute Non-Query) to interact with the PostgreSQL database.
  8. Close the Connection:

    • Don’t forget to include a “Database Disconnect” activity when you’re done with the database connection to ensure proper cleanup.
  9. Error Handling:

    • Implement error handling, such as Try-Catch blocks, to handle exceptions that may occur during database operations.

Remember to securely manage your database credentials and ensure that your remote PostgreSQL server is configured to accept connections from your UiPath machine’s IP address or hostname.

By following these steps, you should be able to connect to your remote PostgreSQL database from UiPath Studio and perform database operations as needed in your automation.

Thanks!!

1 Like

For my case, there was some system configuration problem.

Thanks everyone!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.