How to connect a service to an external database ?

Raphael Sprumont July 11, 2018

I'm trying to develop new custom modules for JIRA instance.

For that I need a connection to an external database.

On the code view I have something like that:

private void initConnection()throws SQLException{
if(this.conn != null && this.conn.isClosed()){
this.conn.close();
}
String host = this.customConfig.getHost()+":"+this.customConfig.getPort();
String url = "jdbc:postgresql://"+host+"/"+this.customConfig.getDatabase();
Properties props = new Properties();
props.setProperty("user",this.customConfig.getUsername());
props.setProperty("password",this.customConfig.getPassword());
props.setProperty("ssl","true");
this.conn = DriverManager.getConnection(url, props);
}

Last line throw this error : java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/db-dev

Someone to help me ?

2 answers

0 votes
Raphael Sprumont July 12, 2018

Hello @Mark Markov,

Yes, I do, url is correct and I have tried with adding postresql-jdbc.jar on lib folder.

Nothing works...

Jira server work already with a postgresql database, so the driver is already on it.

0 votes
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 11, 2018

Suggest an answer

Log in or Sign up to answer