JAVA - Quip - XQuery - Database, the solution !

Here is a sample code to connect to a Database and make some “XQueries” through Quip with JAVA…enjoy !

my parameters are:

- sever: http://localhost/tamino
- DBname: XianDB
- collection: ino:etc
- quip.exe loc: F:/Quip/quip.exe


import java.util.;
import com.softwareag.xtools.quip.xqueryAPI.
;

public class x {
public static void main(String args){

Properties obj = new Properties();
StringBuffer stringbuffer1 = new StringBuffer();

try {
String x = “http://localhost/tamino/XianDB” ;

obj.put(“quipcmd”,“F:/Quip/quip.exe” );

String query = “let $x := fromCollection(“ino:etc”)/News/Subject return $x”;

Connection connect = DriverManager.getConnection( x, (Properties)obj );
QueryResult result = connect.executeQuery(query);

System.out.println(result.getRawString());

} catch (XQueryException XQEx) {
System.out.println("XQueryException: " + XQEx.getMessage());
}
}
}

hello,

I tried to run the above program. but i am getting the following exception.

Exception in thread “main” java.lang.NullPointerException
at testQuip.main(testQuip.java:16)

And even i am trying to print the connction obj then it is giving as null.

I used the same program by connction to the local hard disk uri then it is working fine.

Thanks
dhiraja

Hello,

Could you please give me a hand?
I tried to run this program and got the same error message.
What I want to do is just trying to query a xml file, but it can’r work.

Thank you,
Chandler