Accessing Database/table from a Extension

I am trying to query a DB table from an extension that implements IPSItemInputTransformer.

For simplicity, I even created the table ‘Taxmeshtable’ in the Rhythmyx database

I get the error that Resource not found.

Here’s what I did…for a simple test

I wrote the query

String query = “SELECT * FROM Taxmeshtable”;

String meshTerms = executeGetMeshTermsQuery(query);

and I have

private String executeGetMeshTermsQuery(String query)
{
	try
	{
		Query q = cmgr.createQuery(query, Query.SQL);
		QueryResult result = cmgr.executeQuery(q, 1, null, null);
		RowIterator iterator = result.getRows();
	
		while (iterator.hasNext())
		{
			System.out.println("Row found");
			Row row = iterator.nextRow();
			Value mterms = row.getValue("meshterms");
			Value taxkey = row.getValue("taxonomykey");
		}
	}

What is cmgr? Have you tried it with PSOSimpleSqlQuery? (it is part of the PSOToolkit)

Thank you so much! It works! Here’s what I changed it to…

try {
			
			java.util.List<Object[]> qparam = new ArrayList<Object[]>();
			
			java.util.List<Object[]> result = PSOSimpleSqlQuery.doQuery("SELECT * from Taxmeshtable", qparam);
			System.out.println("Result of the SQL Query count" + result.size());
			
		}catch (SQLException e)
		{
			System.out.println("SQL Exception " + e.getMessage());
		} catch (NamingException e)
		{
			System.out.println("Naming Exception " + e.getMessage());
		}