build DBD-Oracle on strawberry perl 5

來源:互聯網
上載者:User

copy from perl.org wiki page because I can't view that page from company computer.

Install DBD::Oracle on Strawberry Perlfeedback
Contents

 [hide]

  • 1 DBD::Oracle Prerequisites
  • 2 Installation Instructions
  • 3 Special Note on DBD::Oracle 1.28
  • 4 Earlier notes
  • 5 Older information on Using DBD::Oracle and Oracle Instant Client
[edit]DBD::Oracle Prerequisites

You will need the Oracle Instant Client. Download the appropriate version, 32- or 64-bit, to match your Strawberry Perl. You will need three packages:

  • Instant Client Package - Basic (or Basic Lite)
  • Instant Client Package - SQL*Plus
  • Instant Client Package - SDK

Unzip all three into the same location on your hard drive. You will end up with all of the files inside a folder named "instantclient_XXX" (XXX is the major & minor version number). Make sure the full path to the instantclient directory does not have any spaces.

Add the instantclient directory to your Path environment variable. Once you do this, to verify, run the command `sqlplus` from a DOS prompt; if you are asked for a username, then you have modified the Path environment variable correctly.

WARNING: If you do not have the instantclient directory in your Path, then DBD::Oracle might build, but every time you try to use DBD::Oracle you will get the error "The program can't start because OCI.dll is missing from your computer". The error appears as a pop-up window, which must be dismissed before your program can continue. Your only solution is to make sure you have the Path configured properly, so test carefully!

[edit]Installation Instructions

DBD::Oracle can be installed using the CPAN client through a DOS prompt. Before starting the CPAN client, set your ORACLE_HOME environment variable to be the full path to the instantclient directory (see the section above).

If you want the installer to test the module against a live Oracle database, then configure the ORACLE_SID, TWO_TASK, or ORACLE_USERID environment variables as appropriate. See the README files in the DBD::Oracle build directory for more information. If the installer does not have a live database against which to test, then most tests will be skipped or aborted, but no tests should fail.

Begin by starting CPAN and running the commands:

  • get DBD::Oracle, and
  • i DBD::Oracle

If the CPAN version of DBD::Oracle is 1.29 or later, then just run install DBD::Oracle to build, test, and install the module. You will see warnings about unused variables, differing signedness in passed arguments, and similar warnings, which are normal (and annoying). Test failures should not be ignored.

If the CPAN version is 1.28, then see the special instructions below:

[edit]Special Note on DBD::Oracle 1.28

DBD::Oracle version 1.28 has a critical bug which prevents it from being built in Windows. If you see the error "undefined reference to `OCIServerRelease'" at build time, then you are affected by this bug. Here is the workaround:

In CPAN, run the commands:

  • get DBD::Oracle and
  • look DBD::Oracle

You will be dumped into a DOS prompt in a clean DBD::Oracle build directory. Look for the file named "oci.def"; edit the file by adding "OCIServerRelease" to the empty line at the end of the file.

Run perl Makefile.PL, dmake, dmake test, and dmake install. Once the module is installed, exit and you should be returned to the CPAN prompt.

[edit]Earlier notes
  • Makefile.PL does not include DBI directory. Even if you follow carefully the instruction on README.win32.txt and README.wingcc.txt (bundled with the module) it is not possible to build DBD::Oracle. My quick and dirty solution was to edit manually the makefile created by Makefile.PL, adding the path to DBI module to the INC variable.
[edit]Older information on Using DBD::Oracle and Oracle Instant Client
Download and install the Oracle Instant Client
  • http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html

The manual sucks. Just get everything unpacked into C:\Program Files\Oracle\Instant Client 1.11

With Oracle Instant Client, be sure to use a recent DBD::Oracle (1.22 will have a lot of fixes for Instant Client). You might need to add double quotes around the locations where the space in 'C:/Program Files' would cause havoc, like in INC = and LD_RUN_PATH =.

Set up the TNS_ADMIN stuff
> cd "\Program Files\Oracle"> md Admin> cd Admin  
C:\Program Files\Oracle\Admin>type sqlnet.oraNAMES.DIRECTORY_PATH = (TNSNAMES, ONAMES, HOSTNAME)
C:\Program Files\Oracle\Admin>type tnsnames.oraODBCO = (  DESCRIPTION =  ( ADDRESS_LIST =    ( ADDRESS =      ( PROTOCOL        = TCP           )      ( PORT            = 1521          )      ( HOST            = orahost       )      )    )  ( CONNECT_DATA =    ( SERVICE_NAME      = share         )    )  )

Check on 'orahost' what services are available with the command lsnrctl services'. use the available service where above sample uses 'share'

Set the ENV variables in "My Computer"
ORACLE_HOME=C:\Program Files\Oracle\InstantClient-11.1TNS_ADMIN=C:\Program Files\Oracle\AdminPath=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Program Files\Oracle\InstantClient-11.1
Start testing

Not all of the below might be absolutely needed, but try these:

set ORACLE_SID=TESTSIDset DBI_USER=usernameset DBI_PASS=passwordset ORACLE_USERID=%DBI_USER%/%DBI_PASS%set DBI_DSN=dbi:Oracle:host=orahost;sid=%ORACLE_SID%;port=1521set ORACLE_DSN=%DBI_DSN%

With the most recent update in DBD::Oracle, the rest should be reasonably smooth.

set ORACLE_DSN=dbi:Oracle:ODBCO

is an other option that should work. Where ODBCO is the entry in tnsnames.ora

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.