I'd like to know if it's possible to utilise the Jira database connection pool in my own plugin.
At the moment, if I want to talk to the DB I have to create my own connection to the DB. Ideally I'd like to be able to grab a connection from connection pool jira uses already for the application. Is this possible?
Community moderators have prevented the ability to post new answers.
org.ofbiz.core.entity.jdbc.SQLProcessor sqlProcessor=null;
sqlProcessor=new org.ofbiz.core.entity.jdbc.SQLProcessor("defaultDS");
String query = "QUERY";
ResultSet rs=sqlProcessor.executeQuery(query);
In this example, "defaultDS" is passed as the helperName / datasource. I presume you would normally pass the connection string to the DB in here, but that sounds like it might then create a new pool? Or does the pool have a name which you can pass in here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
JIRA will pool the property from dbconfig.xml
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
data source is located in the jira_home/conf/server.xml
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry, but I'm looking in server.xml and I don't see anything screaming out as datasource. Under which node is it stored?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
from JIRA 4 it is /home/dbconfig.xml
"deafultDS" is the default name of the datasource, until it is not custimzed in your dbconfig.xml it should be used in your plug-in code that way
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm on Jira 5. Let me try with defaultDS as I certainly don't recall changing anything when it was setup. If this works I'm good, but then it would still be interesting to know where this is defined.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am also trying the above. The sqlProcessor object has below value i.e conn is null
commitMode:EXPLICIT_COMMIT | conn:null | SQL : 'null'
Am i missing anything in the configuration?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in /home/dbconfig.xml
<jira-database-config> <name>defaultDS</name> <delegator-name>default</delegator-name> <database-type>mysql</database-type> <schema-name></schema-name> <jdbc-datasource> <url>jdbc:mysql://localhost:yourport/yourdbname?useUnicode=true&amp;characterEncoding=yourencoding&amp;sessionVariables=storage_engine=InnoDB</url> <driver-class>com.mysql.jdbc.Driver</driver-class> <username>yourusername</username> <password>yourpassword</password> <pool-size>15</pool-size> <validation-query>select 1</validation-query> </jdbc-datasource> </jira-database-config>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alternatively if this is not possible, I would like to pool my own connections once the plugin starts. Where is the best place to implement this? I presume somewhere in the interface for our plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.