Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> interText issues
Has anyone had ANY luck with interText on Oracle 8.1.5 (winnt)? I have been
beating my head against the wall for about three hours and I can't seem to
get it to work. I have "attached" a fairly trivial example of trying to use
interText to convert a file to an HTML file. I also have attached what
happens when I run this file.
I have tried to manually (through SQL+) call the procedures and I get basically the same error. I have tried running the htxht.exe utility, it does nothing. I have done everything I can think of, but I have absolutely ZERO experience with Oracle. So if anyone has any theories I would be more than happy to try.
Any help would be greatly appreciated!
-Justin
The file I tried to run:
--Filter.java---
import java.sql.*;
import java.io.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
class Filter
{
public static void main (String args []) throws SQLException, IOException
{
// Load the Oracle JDBC driver
if (args.length != 1)
{
System.out.println("usage: Filter filein");
System.exit(0);
}
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String database = file://your info here
String user =
String password =
Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@" +
database, user, password);
System.out.println ("connected.");
try
{
file://do the fun stuff here!
// Create the tables
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
System.out.print("creating tmp tables...");
try
{
stmt.execute("DROP TABLE DOCUMENTS");
}
catch (Exception e)
{
System.out.println(e);
}
try
{
stmt.execute("DROP TABLE filtertab");
}
catch (Exception e)
{
System.out.println(e);
}
stmt.execute ("CREATE TABLE DOCUMENTS (DOCID NUMBER(10,0) PRIMARY
KEY,THEBLOB BLOB)");
stmt.execute ("CREATE TABLE filtertab (query_id number, document
clob)");
file://conn.commit(); keep it temporary
System.out.println("...done!");
file://stmt.close(); I think I can continue to use this
System.out.print("Inserting the blob...");
file://do the blob dance
stmt.execute("INSERT INTO DOCUMENTS VALUES(1,empty_blob())");
File file = new File(args[0]);
InputStream fileInStream = new FileInputStream(file);
BLOB blob = null;
ResultSet rset = stmt.executeQuery("SELECT THEBLOB FROM DOCUMENTS WHERE
DOCID=1");
if (rset.next())
{
blob = ((OracleResultSet)rset).getBLOB(1);
}
OutputStream blobOutStream = blob.getBinaryOutputStream();
int chunk = blob.getChunkSize();
byte[] data = new byte[chunk];
int length = -1;
while ((length = fileInStream.read(data)) != -1)
{
blobOutStream.write(data,0,length);
}
blobOutStream.close();
fileInStream.close();
System.out.println("...done!");
System.out.print("Committing...");
conn.commit();
System.out.println("...done!");
System.out.print("Indexing the column...");
file://index the blob
stmt.execute ("CREATE INDEX TEXTINDEX ON DOCUMENTS(THEBLOB) INDEXTYPE IS
CTXSYS.CONTEXT");
System.out.println("...done!");
System.out.print("Committing...");
conn.commit();
System.out.println("...done!");
file://get the blob back and stream it out
System.out.print("Streaming out the original blob...");
rset = stmt.executeQuery("SELECT THEBLOB FROM DOCUMENTS WHERE DOCID=1");
if (rset.next())
{
blob = ((OracleResultSet)rset).getBLOB(1);
}
file = new File(args[0]+".out");
OutputStream fileOutStream = new FileOutputStream(file);
InputStream blobInputStream = blob.getBinaryStream();
while ((length = blobInputStream.read(data)) != -1)
{
fileOutStream.write(data,0,length);
}
fileOutStream.close();
blobInputStream.close();
System.out.println("...done!");
file://do the translation
System.out.print("Filtering...");
CallableStatement cstat = null;
file://cstat = conn.prepareCall("BEGIN CTX_DOC.FILTER(?,?,?,?,?);
END;");
cstat = conn.prepareCall("{call CTX_DOC.FILTER(?,?,?)}");
cstat.setString(1,"TEXTINDEX"); file://index_name cstat.setString(2,"1"); file://key cstat.setString(3,"filtertab"); file://result table namefile://cstat.setString(4,"1"); file://result id file://cstat.setBoolean(5,false); file://html (false)
System.out.println("...done! Converted: " + cstat.execute());
System.out.print("Streaming out the result...");
CLOB clob = null;
rset = stmt.executeQuery("SELECT DOCUMENT FROM RESULTS WHERE
filtertab=1");
if (rset.next())
{
clob = ((OracleResultSet)rset).getCLOB(1);
}
file = new File(args[0]+".html");
OutputStream htmlOutStream = new FileOutputStream(file);
InputStream htmlClobInStream = clob.getAsciiStream();
length = clob.getChunkSize();
data = new byte[length];
while ((length=htmlClobInStream.read(data)) != -1)
{
htmlOutStream.write(data,0,length);
}
htmlOutStream.close();
htmlClobInStream.close();
System.out.println("...done!");
rset.close(); stmt.close(); conn.close();
}
}
}
--The resulting output--
E:\myprojects\oracleext>java Filter data/simple.doc
connected.
creating tmp tables......done!
Inserting the blob......done!
Committing......done!
Indexing the column......done!
Committing......done!
Streaming out the original blob......done!
Filtering...java.sql.SQLException: ORA-20000: ConText error:
DRG-11101: failed to open file \drgit5
ORA-06512: at "CTXSYS.DRUE", line 122 ORA-06512: at "CTXSYS.CTX_DOC", line 379 ORA-06512: at line 1
java.sql.SQLException: ORA-20000: ConText error: DRG-11101: failed to open file \drgit5
ORA-06512: at "CTXSYS.DRUE", line 122 ORA-06512: at "CTXSYS.CTX_DOC", line 379 ORA-06512: at line 1 at oracle.jdbc.oci8.OCIDBAccess.check_error(Compiled Code) at oracle.jdbc.oci8.OCIDBAccess.executeFetch(Compiled Code) at
at
oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
a:899)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(Compiled Code)
at
oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:130
6)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1341)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:256)
at
oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
ement.java:273)
at Filter.main(Compiled Code) Received on Fri Aug 27 1999 - 01:16:51 CDT
![]() |
![]() |