problem with dropDB

Tuesday, 25 May 2010 · 2 messages
S
Sateesh25 May 2010 08:51 #
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
CG
Christian Grün25 May 2010 12:16 #
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
Quoted text · Sateesh · 76 lines
On Tue, May 25, 2010 at 8:51 AM, Sateesh <sateesh at 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 at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >

⚡Generated with XQuery