Hi

Is it possible to use the connection pool from ivy in a Java class?

I currently reading the database configuration with : Ivy.wfCase().getApplication().findExternalDatabaseConfiguration("myDB")

and open the configuration with: ch.ivyteam.db.jdbc.DatabaseUtil.openConnection(dbConf) ch.ivyteam.db.jdbc.DatabaseUtil.DatabaseUtil.closeConnection(conn);

With this approach it doesn't use the pooled connections like in an ivy database step.

asked 10.03.2016 at 09:17

Michael's gravatar image

Michael
(suspended)
accept rate: 0%


Hi

You can use the following NON Public API:

IExternalDatabaseApplicationContext applicationDbContext =  (IExternalDatabaseApplicationContext)Ivy.wfCase().getApplication().getAdapter(IExternalDatabaseApplicationContext.class);
IExternalDatabase database = applicationDbContext.getExternalDatabase(externalDatabaseConfiguration);
Connection connection database.getConnection(); // get connection from pool
try
{
  ....
}
finally
{
  connection.close();  // give back connection to pool
}

Note that this is an INTERNAL API. Therefore, it can change without further notice from version to version.

link

answered 14.03.2016 at 13:55

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.9k202857
accept rate: 74%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×52
×32
×32

Asked: 10.03.2016 at 09:17

Seen: 2,575 times

Last updated: 14.03.2016 at 13:55