Hi Matt,

On 19/04/13 06:18, Drover, Matt wrote:
Context context = new Context();

String query = "select metadatavalue.text_value from metadatavalue where item_id=" + item_id + " and metadatavalue.metadata_field_id=1";

TableRow row = DatabaseManager.querySingle(context, query );

String result = row.getStringColumn("text_value");


Creating a context object without tidying up after it creates a database connection leak, which is causing the error you're getting. Simply make sure that you abort or complete every Context instance that you create. So, in this case, once you have the result string, call context.abort() and you should be all sorted (rule of thumb: use abort if you made no data changes; otherwise use complete). You probably want to wrap the last three lines of your code snippet in a try block, with the call to abort in the finally clause -- just to make sure it gets called even if there is an exception.

cheers,
Andrea


-- 
Dr Andrea Schweer
IRR Technical Specialist, ITS Information Systems
The University of Waikato, Hamilton, New Zealand


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to