HI All,
I have a problem with dropDB which is not deleting my database.following is the code that iam using.
package sampletest;
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
Dear Sateesh,
as a general guideline, you should try to avoid mixing our APIs. If you run your query with the internal BaseX commands (as e.g. shown in http://www.basex.org/code/QueryExample), you shouldn't encounter any problems.
Best, Christian
On Tue, May 25, 2010 at 8:51 AM, Sateesh sateesh@intense.in wrote:
HI All,
I have a problem with dropDB which is not deleting my database.following is the code that iam using.
package sampletest;
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
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de