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??


In reply to Trying to connect to an Oracle DB on Windows from DBD:ODBC on UNIX. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.