import org.basex.core.Context;
import
javax.xml.xquery.XQConnection;
import
javax.xml.xquery.XQDataSource;
import
javax.xml.xquery.XQExpression;
import org.basex.core.proc.CreateDB;
import
org.basex.core.proc.DropDB;
public final class XQJQuery {
/** Database driver. */
private
static final String DRIVER = "org.basex.api.xqj.BXQDataSource";
static final Context CONTEXT = new
Context();
/** Sample query. */
private static final String QUERY = "for $x in doc('largexmls')//ROW
return distinct-values($x/Number)
";
/** Private constructor.
*/
private XQJQuery() {}
public static void main(final String[] args)
{
try
{
new CreateDB("D:/Aircel/xQuery/XML/largexml.xml",
"largexmls").execute(CONTEXT);
//new
Open("largexml").execute(CONTEXT);
XQDataSource xqd
= ((XQDataSource) Class.forName(DRIVER).newInstance());
// Build a connection to the
specified driver.
final XQConnection conn =
xqd.getConnection();
// Prepare the expression with the document and the
query.
final XQExpression expr =
conn.createExpression();
// Execute the query.
expr.executeQuery(QUERY);
expr.close();
conn.close();
// Close the
expression.
System.out.println("value is :"+new
DropDB("largexmls").execute(CONTEXT));
}
catch(Exception
excp)
{
excp.printStackTrace();
}
}
}
Please help me on how can i delete the DB.
Thanks & Regards
Sateesh.A