I use Oracle remotely from Windows all of the time. I don't use ODBC anymore and just connect directly using the Oracle client libraries.
- Install and configure Oracle client on Windows
- Install ActivePerl
- Install DBI module
- Install DBD::Oracle module
If you are having trouble connecting, you might have to rename the oci.dll that is installed when installing DBD::Oracle in the Perl bin directory. I have had conflicts with previously installed clients before and having this oci.dll and the Oracle client both installed caused an issue.
Use the following connection string syntax in the DBI connection:
my $dsn = 'dbi:Oracle:host=10.1.1.100;sid=XX;port=1521';
I also use an eval to trap any errors when trying to connect to the database
my $dbh;
eval {
$dbh = DBI->connect( $dsn, $username, $password) ||
die "Cannot connect to database - [$dsn]: $DBI::errstr";
};
if ($@) {
log("[Error] COULD NOT CONNECT TO DATABASE: [$@]\n");
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|