Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Summary:

I am trying to connect to an oracle 8.1 db on a Windows server from my Solaris 2.8 UNIX station.

I have no previous experience as a UNIX or db admin, so feel free to tell me the obvious...,

I installed Perl 5.8.2, DBI 1.38, DBD-ODBC-1.06, iodbc-3.51.1, myODBC-3.51.06... and mysql-4.0.16

I have successfully created a db in mysql, and accessed it via the perl DBI and DBC::ODBC modules.

But, I cannot seem to connect to the oracle database. When I try to connect to another DSN (see below) on the Windows server, it doesn't seem to be even attempting to find my database. Instead, it tells me that the database and table that I want to connect to does not exist. I am presuming that it is trying to connect to the mysql database.? (I base this assumption on previous errors which keeps referring to the user as user@localhost)

I have tried using iodbcadmin-gtk to make a 'proper' DSN, but when I run 'test' it says

[iODBC][Driver Manager]No DSN entered.

It says the same thing when I am testing the local mysql data base, in spite of the fact that the perl DBI script works.

content of /etc/odbc.ini

<readmore> ; ; odbc.ini configuration for MyODBC and MyODBC 3.51 Drivers ; [ODBC Data Sources] myodbc3 = MySQL ODBC 3.51 Driver DSN myDSN = MySQL ODBC 3.51 Driver DSN [myDSN] Driver = /usr/local/lib/libmyodbc3.so Description = MyDatabase description SERVER = ThisIsWhereMyDataBaseIs PORT = 1521 PROTOCOL = TCP SERVICE_NAME = myDSN [myodbc3] Driver = /usr/local/lib/libmyodbc3.so Description = MySQL ODBC 3.51 Driver DSN SERVER = localhost PORT = USER = root Password = Database = test OPTION = 3 SOCKET =

I read some of the dbi.users.org FAQs, and one question was how to create a DSN, but the answer seemed to point to a windows solution.

Another FAQ suggested using an non-DSN approach, but I am not sure of the proper fields.

When I use the following DSN definition, the test program says it can't find the driver.

my $DSN = 'driver=Oracle ODBC Driver;dbq=myDSN'; my $dbh = DBI->connect( "DBI:ODBC:$DSN", "name", "password") or die ("Could not make connection to database: $DBI::errstr");
[download]
this code just hangs the computer
my $DSN = 'driver=/usr/local/lib/libmyodbc3.so; server=MyDataBaseIsOnThisMachine; database=myDSN;protocal=TCP; port=1521; uid=myname; pwd=mypassword;'; my $dbh = DBI->connect( "DBI:ODBC:$DSN", "name", "password") or die ("Could not make connection to database: $DBI::errstr");
[download]
this just connects me to mysql (I think) and then complains that 'mydatabase' does not exist when I do a SELECT on one of the tables.
my $DSN = 'driver=/usr/local/lib/libmyodbc3.so; host=MyDataBaseIsOnThisMachine; database=myDSN; protocal=TCP; port=1521; uid=myname; pwd=mypassword;'; my $dbh = DBI->connect( "DBI:ODBC:$DSN", "name", "password") or die ("Could not make connection to database: $DBI::errstr");
[download]
In the beginning I tried running some sample code on my PC (under Windows) and the following worked just fine.

my $dbh = DBI->connect( "DBI:ODBC:myDSN", "myname", "mypassword") or die ("Could not make connection to database: $DBI::errstr");
[download]

Is there anybody who can help me?

Sandy

PS: After all this work (it took me about a week to install all of this stuff), I heard about DBD-Proxy. But if I understand correctly I have to install something on the Windows database server??

Replies are listed 'Best First'.
Re: Trying to connect to an Oracle DB on Windows from DBD:ODBC on UNIX.
by mpeppler (Vicar) on Nov 27, 2003 at 01:53 UTC
    In order to get ODBC to work you still need the correct ODBC driver for your platform - in your case an ODBC driver for Oracle under Solaris. I don't know if Oracle has one, or if there is a third party that has one - you may want to hit Google on that issue.

    Michael

Re: Trying to connect to an Oracle DB on Windows from DBD:ODBC on UNIX.
by rdfield (Priest) on Nov 27, 2003 at 11:53 UTC
    You'll want DBI::ProxyServer, DBI and DBD::Oracle on your Windoze box. Since the Windoze box has an Oracle Server installed, you will almost certainly have 'enough' Oracle software installed for DBD::Oracle to work properly.

    rdfield

      Thank you, I'll give it a 'go', assuming of course that my DBA allows me to put anything on the server.

      Sandy

Re: Trying to connect to an Oracle DB on Windows from DBD:ODBC on UNIX.
by Itatsumaki (Friar) on Nov 27, 2003 at 01:54 UTC

    Do you have to use DBD::ODBC? Perhaps things would go much faster with DBD::Oracle.

      Question: I thought the whole point of ODBC is that it can be used to read any database??

      To install DBD:Oracle I need to have Oracle installed on my UNIX box. We have a client Oracle installation through a third party which requires this, but it does not have all of the needed files. For example, Pro-C etc.

      Comment from README file

      Install enough Oracle software to enable DBD::Oracle to build. That usually includes Pro*C and SQL*Net. That's not very specific because it varies so much between Oracle releases.
      Since this is a 'proof of concept' project, and since time is short, and since bureaucracy takes for ever to purchase anything, I had hoped to do this with open source stuff.

      I went to my DBM and asked about Oracle for UNIX and they did not have any info for me. The Oracle web-site is simply a labyrinth of confusion.

      Is this really not possible to do??

      Anybody know anything about DBD-Proxy?

      Thanks, Sandy

        You should listen to the master mpeppler - author of DBD::Sybase. ODBC is just a convenient top level interface, you still need database specific drivers. If you 'google' for 'Freeware Solaris 2.8 Oracle ODBC Driver', you will end up with thousands of related links. Beware that most of these Oracle drivers are not free, you will just have to keep searching.

        The following ODBC driver for solaris looks good, but it's not free. :-(

        http://www.easysoft.com/products/2104/main.phtml