1 Reply Latest reply: Oct 31, 2006 12:19 PM by 488514 RSS

    Cannot get Java Query API to work

    488514
      I am trying to use the ultrasearch java api and am having no luck. I get this error:

      Exception in thread "main" oracle.ultrasearch.query.SearchException: WKG17005: connection failure: Closed Connection
      at oracle.ultrasearch.query.Instance.connect(Instance.java:383)
      at oracle.ultrasearch.query.Instance.getResult(Instance.java:561)
      at oracle.ultrasearch.query.Instance.getResult(Instance.java:725)
      at oracle.ultrasearch.query.Instance.getResult(Instance.java:677)
      at Test.search(Test.java:77)
      at Test.main(Test.java:92)

      Here is my code:

      oracle.ultrasearch.query.Instance searcher=new oracle.ultrasearch.query.Instance();
      Connection conn=getConnection();
      try {
      searcher.setConnection(conn);
      searcher.setInstanceName("ULTRASEARCH_DOTORG");
      oracle.ultrasearch.query.Request searchRequest=new oracle.ultrasearch.query.Request();
      oracle.ultrasearch.query.Query searchQuery=new oracle.ultrasearch.query.Contains("water", searcher.getMetaData());
      searchRequest.setQuery(searchQuery);
      oracle.ultrasearch.query.Result searchResults=searcher.getResult(searchRequest);
      } finally {
      conn.close();
      }

      Note that "getConnection()" is using the standard OracleDataSource class supplied with the current 10g driver; I've used it to connect to other oracle databases without trouble. I am working within a standard Windows JDK 1.5 (also tried 1.4.2) environment.


      I've also tried using QueryInstance instead of Instance - exception and code follow:

      Exception in thread "main" oracle.ultrasearch.query.SearchException: WKG17005: connection failure: User credentials doesn't match the existi
      ng ones
      at oracle.ultrasearch.query.Instance.connect(Instance.java:383)
      at oracle.ultrasearch.query.Instance.getMetaData(Instance.java:432)
      at Test.search2(Test.java:89)
      at Test.main(Test.java:94)

      oracle.ultrasearch.query.QueryInstance searcher=new oracle.ultrasearch.query.QueryInstance();
      searcher.setConnectionString(jdbcURL);
      searcher.setUser(jdbcUserName);
      searcher.setPassword(jdbcUserPass);
      searcher.setInstanceName("ULTRASEARCH_DOTORG");
      oracle.ultrasearch.query.Request searchRequest=new oracle.ultrasearch.query.Request();
      oracle.ultrasearch.query.Query searchQuery=new oracle.ultrasearch.query.Contains("water", searcher.getMetaData());
      searchRequest.setQuery(searchQuery);
      oracle.ultrasearch.query.Result searchResults=searcher.getResult(searchRequest);

      Any ideas?