Re: interText issues
Date: Fri, 27 Aug 1999 12:22:10 GMT
Message-ID: <37c68102.8274808_at_newshost.us.oracle.com>
Justin,
You need to check two things:
- You have external procedures configured correctly for your database. Because the filtering mechanism in interMedia Text uses external procedures, if you can't "TNSPING EXTPROC_CONNECTION_DATA" from a DOS window, then you don't have this working properly.
Your files on the server should look something like:
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = my-pc)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc) (ORACLE_HOME = D:\Oracle\Ora81) (PROGRAM = extproc)
)
(SID_DESC =
(ORACLE_HOME = D:\Oracle\Ora81) (SID_NAME = your_SID_here)
)
)
tnsnames.ora:
your_alias_here =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = my-pc)(PORT = 1521)) )
(CONNECT_DATA =
(SERVICE_NAME = your_SID_here)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(SOURCE_ROUTE = OFF)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(Key = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
)
)
2) The System (not User) Environment Variable in Windows NT, ORACLE_HOME, is set to your Oracle8i home. Note that I'm not referring to a registry entry. You will need to reboot after setting this for it to take effect.
Hope this helps.
On Fri, 27 Aug 1999 00:16:51 -0600, "Justin Call" <justin_at_thoughtstar.com> wrote:
>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:_at_" + >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 name > file://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(); > } > catch (Exception e) > { > System.out.println(e); > e.printStackTrace(); > > } > > > } >} > >--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 >oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1169) > > 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) > > >
Thanks!
Joel
Joel R. Kallman Oracle Service Industries
Columbus, OH http://govt.us.oracle.com jkallman_at_us.oracle.com http://www.oracle.com
The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. Received on Fri Aug 27 1999 - 14:22:10 CEST