Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to connect to 3rd party Postgres from Jira plugin?

How to connect to 3rd party Postgres from Jira plugin?

What connector can be used in the Jira plugin to connect to Postgres?
I'm new to Java, more details please.

1 answer

1 accepted

0 votes
Answer accepted


В pox.xml добавил:

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.1</version>
</dependency>
<Import-Package>*;version="0";resolution:=optional</Import-Package>

В классе добавил:

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;

 В методе соединяюсь вот так:

String url = "jdbc:postgresql://<host>:<port>/<database>";
String username = "postgres";
String password = "postgres";
Connection conn = null;

try {
conn = DriverManager.getConnection(url, username, password);

System.out.println("Connected to the PostgreSQL server successfully.");

// Успешное соединение
} catch (SQLException e) {
// Не получилось подключиться
System.out.println(e.getMessage());
}

Перезагрузил либы и скомпилировал так:

atlas-package

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you