Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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.
this code just hangs the computermy $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");
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; 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");
In the beginning I tried running some sample code on my PC (under Windows) and the following worked just fine.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");
my $dbh = DBI->connect( "DBI:ODBC:myDSN", "myname", "mypassword") or die ("Could not make connection to database: $DBI::errstr");
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 | |
|
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 | |
by Anonymous Monk on Nov 27, 2003 at 14:52 UTC | |
|
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 | |
by Anonymous Monk on Nov 27, 2003 at 02:19 UTC | |
by Roger (Parson) on Nov 27, 2003 at 03:42 UTC | |
by Itatsumaki (Friar) on Nov 27, 2003 at 06:07 UTC |