On Oct 6, David Kramer scribed:

> Im new to using DBI, so this question is very simple Im sure.  I have
> searched the web and have read through O'Reilly's Programming the Perl DBI.
> Im trying to connect to an Oracle 8.1.7 database running on Solaris 8.  The
> script itself resides on my app server which is a Win2K box.  Im using
> ActiveState's Perl 5.6.  I have already installed the DBI modules, version
> DBI-1.38 and DBD-Oracle-1.14.  Im pretty sure these versions support DBI
> Oracle connections on Windows(the web said DBI greater than .81)  Below is
> the simple test program Im running to test the connections.  I dont see what
> Im doing, Foo is my database connection string.
>
> ############################
> #### Module Definitions ####
> ############################
>
> use DBI;
>
>
> ##############################
> ####    SQL Statements    ####
> ##############################
>
>
> #Validates daily file and copies backup to archive
> my $dbh = DBI->connect("dbi:Oracle:foo", "source", "source"  )
>    or die "Connect to database connection: $DBI::errstr\n";
>

In my scripts, I use 'or die "cannot connect " . DBI::errstr . "\n";' I'm
not sure why you're not getting a message, but the above line always works
for me (note missing $ before 'DBI::'), when I do something silly, like
mis-spell the database.  The other examples I see of errstr usage all have
it preceded with a handle, but you don't have a handle yet ($dbh->errstr).

Aside from that, my normal test process for Oracle is:
$ tnsping foo
$ sqlplus source/[EMAIL PROTECTED]
If both of those work, and 'make tests' didn't fail, then it should all be
working.  You may want to try the script on the Solaris box, just for
giggles.

> $rows = $dbh->do("create table foo (foocol (varchar2(10))");
>
>
> $dbh->disconnect();
>
>
> The error Im getting is:
>
> C:\>dbtest.pl
> DBI connect('foo','source',...) failed:  at C:\dbtest.pl line 37
> Connect to database connection:
>
> Thanks much,
>
> DK
>
>
> David Kramer
> CRM Back-End Systems Manager
>
> Reflect - True Custom Beauty
> 49 Stevenson Street, suite 300
> San Francisco, CA 94105
> p: 415.369.4856  f:415.369.4801
> c: 650.302.7889
>
>

Reply via email to