cancel
Showing results for 
Search instead for 
Did you mean: 

Database Config Parameter Access

howejr77
Champ in-the-making
Champ in-the-making
Hello,

I'm trying to pull the data to populate a custom constraint from the database. I've got an example working from other posts in the forum but the primary example has all the parameters to access the database hard coded in the constraint class. The example also will establish a new connection to the database as well.

Is there a way to pull these values from the "repository-properties" bean or elsewhere in Alfresco so the constraint is simply accessing the same database as the Alfresco installation? To a deeper level, is there a way to utilize any connection pool Alfresco has already established instead of setting up and tearing down a new connection?

Thank You
Ryan
1 REPLY 1

howejr77
Champ in-the-making
Champ in-the-making
I've gotten something working where I created a bean and used the spring configuration to inject the values into the bean.

I can also then indicate that the new bean must be loaded before my custom model is bootstrapped and the custom constraint can then retrieve the database parameters from there. Works, but does anyone know if these parameters (db.username, db.password. db.url, db.driver) are simply accessible here already? That would seem a bit cleaner to me…

Thanks
Ryan