Thread: Connecting a postgresql client to an oracle7 db

Connecting a postgresql client to an oracle7 db

From
Dominique Duflos
Date:
Hello,
Is it possible to connect the postgresql program psql to an oracle7
database ?

When I tried I got:

bash$ psql -h nan -p 1526 satbase
psql: PQconnectDB() -- couldn't read postmaster response: errno=2
No such file or directory

and on the server side the listener.log file reads:

 05-FEB-02 16:36:51 * 12569
 TNS-12569: TNS:packet checksum failure

On the network, tcpdump saw this:

17:08:35.251072 eth1 > desire.45256 > nantes.1526: S
774363043:774363043(0) win 5840 <mss
17:08:35.261072 eth1 < nantes.1526 > desire.45256: S
499968000:499968000(0) ack 774363044
17:08:35.261072 eth1 > desire.45256 > nantes.1526: . 1:1(0) ack 1 win
5840 (DF)
17:08:35.261072 eth1 > desire.45256 > nantes.1526: P 1:297(296) ack 1
win 5840 (DF)
17:08:35.271072 eth1 < nantes.1526 > desire.45256: F 1:1(0) ack 297 win
32768 (DF)
17:08:35.271072 eth1 > desire.45256 > nantes.1526: F 297:297(0) ack 2
win 5840 (DF)
17:08:35.271072 eth1 < nantes.1526 > desire.45256: . 2:2(0) ack 298 win
32768 (DF)

Thank you for any help.
Dominique Duflos


Re: Connecting a postgresql client to an oracle7 db

From
"Josh Berkus"
Date:
Dominique,

> Is it possible to connect the postgresql program psql to an oracle7
> database ?

Well, no.  Why not use Oracle's own tools?

-Josh Berkus

Re: Connecting a postgresql client to an oracle7 db

From
Dominique Duflos
Date:
Josh Berkus wrote:

> > Is it possible to connect the postgresql program psql to an oracle7
> > database ?
>
> Well, no.  Why not use Oracle's own tools?
>

Ah... Reading the FAQs of PostgresQL and learning that SQL was very
standardized, I had thought I could write an application that could
connect to any SQL-implementing database on our intranet.

Thanks for the quick and definite reply.
DD


Re: Connecting a postgresql client to an oracle7 db

From
"Josh Berkus"
Date:
Domenique,

> Ah... Reading the FAQs of PostgresQL and learning that SQL was very
> standardized, I had thought I could write an application that could
> connect to any SQL-implementing database on our intranet.

You can.  You just need to use each database's *external* interfaces,
 through ODBC, JDBC, or similar data transmission tools.  Psql, like
 Microsoft's Query Analyzer, connects with the database at a more
 "intimate" level where commands are sent directly in the database's
 internal API ... which is *never* standard.  But with Java, Perl, PHP,
 C++ or COM you should ba able to write an application that connects to
 all SQL databases.

HOWEVER, Postgres upholds only about 80% of the standard, and most
 other databases have less.  Oracle, for example, uses a completely
 non-standard notation for Outer Joins that is not compatible with any
 other database, nor will it recognize SQL standard syntax for Outer
 Joins.  This will remain a problem for you even when you use JDBC or
 similar to connect.

If you are going to go ahead with this project, I suggest that you:
1. Read the various "porting" documents at
 http://techdocs.postgresql.org/
2. Buy a copy of "SQL In a Nutshell" from O'Reilly, which has
 feature-for-feature and command-by-command comparison of Postgres,
 MySQL, Oracle, and SQL Server (though it is 1.5 years out of date).
3. REsearch on the Net.  It may be that some kind of "database
 compatibility layer" that allows you to use a single standard syntax
 to address all of your databases exists somewhere, either as Open
 Source or for a fee.
-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

Re: Connecting a postgresql client to an oracle7 db

From
Tom Lane
Date:
"Josh Berkus" <josh@agliodbs.com> writes:
>  ... Oracle, for example, uses a completely
>  non-standard notation for Outer Joins that is not compatible with any
>  other database, nor will it recognize SQL standard syntax for Outer
>  Joins.

I was under the impression that Oracle *does* accept the standard
outer-join syntax.  But there's a lot of people who are used to their
legacy syntax, and a lot of application code that still uses it.

            regards, tom lane

Re: Connecting a postgresql client to an oracle7 db

From
Dominique Duflos
Date:
Josh Berkus wrote:

> > I had thought I could write an application that could
> > connect to any SQL-implementing database on our intranet.
>
> You can.  You just need to use each database's *external* interfaces,
>  through ODBC, JDBC, or similar data transmission tools.
>

I will learn about ODBC and see if I can write a tool over it in Tcl. We
only need very simple operations: open the DB, get a table content, then
close.

Thanks to all.
Dominique Duflos.