Hi there,
we would like to connect Quintus-Prolog with Oracle using TCP/IP.
But we do not know WHAT Prolog have to send the Oracle-Server, e.g.
what kind of data have TERM to be in the Prolog-predicate
tcp_send(Tag,Term) to get an answer from the Oracle-Server.
Does anyone know if it is possible and how or where we can get the
information ?
We are using Quintus-Prolog 3.1.3 and Oracle 7.0.12 on Sun.
Thanx-in-advance
Siegfried Bell
Siegfried Bell be...@ls8.informatik.uni-dortmund.de
Informatik VIII,
Univ. Dortmund, Tel.: +49 231 755-5102
44221 Dortmund Fax : +49 231 755-5105
Germany
I wrote library(tcp). I can tell you that you won't want to use
tcp_send/2. Rather, you'll want to use
tcp_output_stream(+Socket, -Stream)
and then operate on the Stream directly. Perhaps sending SQL queries.
A better solution might be to buy Quintus's interface to Oracle, which
has lots of low-level optimizations.
If all you want to do is send SQL statements for execution to
Oracle and process the results, I suggest you should also think
about using the OCI (Oracle Call Interface) via the foreign
function interface of Quintus/SICStus Prolog rather than sending
SQL statements and parsing its replies.
The advantage of the (C-based) OCI interface is that you get
results and/or error messages in a "structured" form. Otherwise,
you have to parse Oracle's (SQL*Plus?) output and ensure that
your program never waits for output when Oracle isn't sending any.
I have done something like that using pseudo TTY's and RPC
(instead of TCP/IP) for Unify 3.2 back in 1985 and found it to
be a pain.) Thanks to SQL*Net, the OCI also works across the
net (i.e., if your programs run on a host different from the
one where the Oracle database resides).
This is of course not portable to other SQL engines since e.g.
Sybase has a different call interface than Oracle ("dblib").
On the other hand, the solution with parsing the output of
an SQL interpreter is non-portable too, even if the same
"flavor" of SQL is supported by both ... )
--
Robert Marti | Phone: +41 1 632 72 60
Informationssysteme | FAX: +41 1 262 39 73
ETH-Zentrum | E-Mail: ma...@inf.ethz.ch
CH-8092 Zurich, Switzerland |
>A better solution might be to buy Quintus's interface to Oracle, which
>has lots of low-level optimizations.
I'm not sure on the status of that product at the moment, maybe Quintus will
respond directly. The version 3 of ProDBI was actually bought in from Rob
Lucas of Keylink. AIIL distribute the Keylink DBI (contact si...@aiil.co.uk).
This interface is also available for several other commercial Prolog systems
and Sicstus. Versions of it are available for PCs, with a Prolog/ODBC
interface currently nearing completion.
Regards
Paul.
============================================================
Paul Holmes-Higgin Janet: p.holme...@surrey.ac.uk
Artificial Intelligence Group
Dept. of Mathematical and Computing Sciences
University of Surrey
GUILDFORD GU2 5XH
England
A student of mine implemented a QP - Oracle interface using
TCP/IP - He called the PRO*SQL interface (I think this is
what it is called) with an SQL query and waits for the
result relation...You have to tokenize the result because
it's all plain ASCII, but you can use the Prolog built-in
tokenizer for this...
You can have the code, if you want (and the student's
diploma thesis (in German)); this interface was used in
conjunction with my Prolog to SQL compiler.
Christoph
--
------------------------------------------------------------
Christoph Draxler
CIS Centre for Information and Language Processing
Ludwig-Maximilians-University Munich Tel: +49 +89 211 0664
Wagmuellerstr. 23 Fax: +49 +89 211 0674
D 80538 Munich dra...@cis.uni-muenchen.de
------------------------------------------------------------
I am writing a prolog/Oracle interface for SICStus. As
such, I am not familiar with Quintus's tcp_send predicate. I assume
that it sends Term out on the stream connection Tag (or something
similiar). This will not be enough, since, as far as I know
(I have not specifically researched this question), the SQL*Net protocol
is not documented, so you probably won't be able to talk to the RDBMS
kernel directly. You could talk to a SQL frontend, like SQL*plus, via
some kind of pipe or pty setup.
The avenue I am exploring is to use SICStus's C/Prolog interface,
that allows C functions to be called as Prolog predicates (and
the other way around). Quintus will definitely offer something
similiar. I attach onto Oracle using the OCI function library.
This library's drawback (at least in v6) is that it forces you
into a synchronous mode of operation, which should be no problem
for simple prolog applications, however.
Konrad