I try to connect Quip with Tamino database through the Java API with the following code (picked from a previous post):
import java.util.Properties;
import com.softwareag.xtools.quip.xqueryAPI.Connection;
import com.softwareag.xtools.quip.xqueryAPI.DriverManager;
import com.softwareag.xtools.quip.xqueryAPI.QueryResult;
import com.softwareag.xtools.quip.xqueryAPI.XQueryException;
public class Quip {
public static void main(String args) {
Properties prop = new Properties();
try {
String dbLocation =
“http://localhost/tamino/myDB”;
//for memory issues
prop.put(“qmachineoptions”,“+RTS -M200M -RTS”);
prop .put(“quipcmd”, “D:\QuiP\quip.exe”);
String query = “let $x := fromCollection("ino:etc")/myFirstElement/mySecondElement return $x”;
// → Here is the problem ←
Connection connect = DriverManager.getConnection(dbLocation, prop);
QueryResult result = connect.executeQuery(query);
System.out.println(result.getRawString());
} catch (XQueryException XQEx) {
System.out.println("XQueryException: " + XQEx.getMessage());
}
}
}
When I execute this code, an error occured (“NullPointerException”) when the DriverManager try to get the connection.
But when I use a XML file as source, all is OK.
What’s the problem ? Thanks !
Hi Sollan,
I don’t want to ask a silly question, but…
Does this query work on your machine:
http://localhost/tamino/myDB/ino:etc?_xql=/myFirstElement/mySecondElement ?
If this works, something is wrong with the QuiP setup. If it doesn’t, then you have found the problem!
Cheers,
Trevor.
Yes, the query using the URL is working.
But using Java, it seems to be a problem with the URI of the database.
When I set dbLocation to “file:whatever”, the error is not the same (QuiP does not achieve to locate the file (normal behavior), but I don’t get the “nullPointerException”).
Is there any prefix to put before the database URL, like “file:” for a file ?
Hi Sollan,
Puny just gave me a heads-up regarding access to Tamino via the QuiP API.
I’ll pass all the information along to the appropriate people in Development, and we’ll see what can be done.
Thanks in advance for your patience(!),
Trevor.