- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 02:55 AM
Hi All
We are having requirement to get data from postgresql database. We tried to check from the data sources, but failed because servicenow as an OOB doesn't support postgres.
Is there a way to use postgresql as a datasource and run queries on postgresql databases/tables?
Solved! Go to Solution.
- Labels:
-
Discovery
-
Orchestration (ITOM)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 04:41 AM
Yes - you'll need to get the jar file from postgresql that contains the database driver. Navigate to MID Server JAR Files and add a record there for it. (table is ecc_agent_jar), and attach the file there. I got it from https://jdbc.postgresql.org/download.html. ServiceNow will download the driver to your midservers automatically.
Update the data sources form so the choice list for format includes postgresql. It just needs to be an option so you can select it, and also so that you can create business rules / client scripts that define the connection URL. The type will be JDBC.
I did create a before business rule for when type is JDBC, format is PostgreSQL, and the server, port, or name is changed. The connection URL would be composed like this:
current.connection_url = "jdbc:postgresql://" + current.jdbc_server + ":" + current.database_port + "/" + current.database_name;
Database name, port, table name, server, username, and password are the other fields you'll need to set.
Here's the documentation page for this: JDBC Data Sources
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 04:41 AM
Yes - you'll need to get the jar file from postgresql that contains the database driver. Navigate to MID Server JAR Files and add a record there for it. (table is ecc_agent_jar), and attach the file there. I got it from https://jdbc.postgresql.org/download.html. ServiceNow will download the driver to your midservers automatically.
Update the data sources form so the choice list for format includes postgresql. It just needs to be an option so you can select it, and also so that you can create business rules / client scripts that define the connection URL. The type will be JDBC.
I did create a before business rule for when type is JDBC, format is PostgreSQL, and the server, port, or name is changed. The connection URL would be composed like this:
current.connection_url = "jdbc:postgresql://" + current.jdbc_server + ":" + current.database_port + "/" + current.database_name;
Database name, port, table name, server, username, and password are the other fields you'll need to set.
Here's the documentation page for this: JDBC Data Sources
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 12:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 01:20 AM
Hi Anthony
It worked. Thank you for your support 🙂
Regards
Madhavarao L

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2019 01:27 PM
Hi Madhav,
I am getting the error No suitable driver found for jdbc: postgresql. I followed all the steps. Did you encounter similar issue?
Please mark this response as correct or helpful if it assisted you with your question.