Home » Server Options » Text & interMedia » Simple Java Query API Example?
Simple Java Query API Example? [message #76174] Tue, 11 January 2005 02:32
Sebastian Odrich
Messages: 1
Registered: January 2005
Junior Member
Oracle Ultrasearch 10g

I have to write a java util that is startet with a parameter (query-string) and returns the result for this query (plain text).

I read the oracle sampla query application an try this:

// 'QueryInstance' erzeugen und Verbindung definieren
QueryInstance queryInstance = new QueryInstance();
queryInstance.setInstanceName("xxx");
queryInstance.setConnectionString(treiberUrl);
queryInstance.setUser("xxx");
queryInstance.setPassword("xxx");

// 'InstanceMetaData' auslesen
InstanceMetaData instMD=null;
try {
instMD = queryInstance.getMetaData();
} catch (SQLException e) {
e.printStackTrace();
}




// 'Contains' erzeugen
Contains contains = new Contains(query,instMD);

// 'Request' erzeugen
// Request mit Informationen füllen



Attribute title = instMD.getStringAttribute("title");
Attribute author = instMD.getStringAttribute("author");
Attribute description = instMD.getStringAttribute("description");
Attribute [[]] attreq = { title, author, description };

Group[[]] groups;
groups = new Group[[instMD.getGroups().size()]];
for (int i=0; i<instMD.getGroups().size();i+=1) {
groups[[i]] = (Group)instMD.getGroups().toArray()[[i]];
}
Query filter = new From(groups);

Request request = new Request();
request.setQuery(contains);
request.setFilter(filter);
request.setQueryLanguage(Locale.GERMAN);
request.setStartIndex(1); // hier kann jeder beliebige Wert>= 1 stehen
request.setDocsRequested(maxRows); // Anzahl der anzuzeigenden Dokumente
request.setDocLanguage(Locale.GERMAN);
request.setAttributesFetched(attreq);
request.setExcerptLength(200);
request.setStartTag ("");
request.setEndTag ("
");
request.setEllipsisMark (" ... ");


// 'Result' abfragen
Result result = null;
try {
result = queryInstance.getResult(request);
} catch (SQLException e1) {
e1.printStackTrace();
}

The Sampla jsp-application workes fine.
When my program tries to resolve the result from the instance this exception is thrown:

java.sql.SQLException: ORA-20000: Oracle Ultra Search-Fehler
ORA-00936: missing expression
ORA-06512: at "WKSYS.WK_ERR", line 179
ORA-06512: at "WKSYS.WK_QRY", line 1007
ORA-06512: at line 1
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
at oracle.jdbc.ttc7.TTC7Proto .doOall7(TTC7Protocol.java:1894)
at oracle.jdbc.ttc7.TTC7Proto .parseExecuteFetch(TTC7Protocol.java:1094)

Is anybody out there able to help me?
Has anyone out there a simple java query example to get a result from oracle ultrasearch
Previous Topic: C/C+ Sample Program for Oracle in Linux
Next Topic: very urgent - INDEXING/REINDEX
Goto Forum:
  


Current Time: Wed Jul 30 14:14:38 CDT 2014

Total time taken to generate the page: 0.13523 seconds