How I can connect to Oracle from Perl? - perl

We have Oracle Server " Oracle Version: 10.2.0.4.0 - 64bit". I like to connect to this server with Perl from my RHEL machine. I am able to connect via sqlplus successfully. I can use 32-bit or 64-bit Perl. I have few questions.
Which files I should download from Oracle.com and where should I install them?
What are the environment settings or path that I should set?
What are the configuration changes or Makefile arguments changes I should make to install DBD::Oracle module properly?
Thanks.

Please ignore the previous answer as it is woefully out of date.
All you need to download is the oracle "instant client" for Linux:
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
This gives you what you need to build the Perl module.
A quick google brought up the following for an install guide:
http://duberga.net/dbd_oracle_instantclient_linux/
(I'm sure there are others)

Related

Installing temporal_tables and cyanaudit extensions in PostgreSQL for Windows

I have an auditing and slowly changing dimensions (SCD) use case that requires the installation of the PostgreSQL temporal_tables and cyanaudit extensions.
However my PostgreSQL server is on Windows and after searching high and low, I still haven't found a way to install these extensions in PostgreSQL for Windows.
Has anyone succeeded in installing these extensions in the Windows environment and can you please share your methodology?
Thanks a million,
JDaniel
I have not tried to install these extensions on Windows but I suggest you have a look on the related source code repositories.
temporal_tables is stored on GitHub: if you search in open and closed issues about Windows installation, I have found: https://github.com/arkhipov/temporal_tables/issues/19.
cyanaudit is stored on bitbucket and I have not found anything related to Windows.
However installation should be easier because it is mainly SQL and PL/PGSQL code: you need to be able to use tar and perl because the installer is using Perl.

Unable to Install DBD::Oracle for Perl on Windows

When trying to install DBD::Oracle library i received the following error message "Can't load /usr/lib/perl5/site_perl/5.24/x86_64-cygwin-threads/auto/DBD/Oracle/Oracle.dll for module DBD::Oracle: No such file directory at /usr/lib/perl5/5.24/x86_64-cygwin-threads/DynaLoader.pm"
I installed the DBD::Oracle library on windows using the below steps:
instantclient-basic-11.2.0.4.0
instantclient-sqlplus-11.2.0.4.0
instantclient-sdk-11.2.0.4.0
Then, I unzip them all to c:\Oracle.
Next, I included the below directory in my system environmental on windows as shown below
ORACLE_HOME=C:\Oracle\instantclient_11_2
LD_LIBRARY_PATH=C:\Oracle\instantclient_11_2\lib (There is no lib directory in this folder, but i followed the instructions of an online article regardless)
Finally, I opened command prompt and ran and received that error message:
perl -MCPAN -e "install DBD::Oracle"
I resolved the problem by installing the 32-bit Oracle Client 11g version onto the computer in this location c:\oracle. It doesn't work using the instantclient version because the instant client doesn't contain the necessary libraries.
Download "Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (32-bit)" from the below link and install the full administrator verion
http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html
Next, create ORACLE_HOME variable in your environmental variables on your computer and add the following path to it: ORACLE_HOME=C:\Oracle\product\11.2.0\client_1
Next, create LD_LIBRARY_PATH variable and add the below path:
LD_LIBRARY_PATH=C:\Oracle\product\11.2.0\client_1\lib
Afterwards, install module using perl without testing it. During the test it will fail, because its trying to connect to your database:
perl -MCPAN -e shell
notest install DBD::Oracle
Open the odbcad32.exe in this location C:\Windows\SysWOW64\ and click Add. Type Oracle for the name and description and click save. The SysWOW64 will connect the 32-bit version of the odbcad32 application to create the reference.
NOTE: The biggest problem you will have is to ensure you are using 32-bit drivers using cygwin, oracle software, and odbcad32. You will receive that can't load library if you mix 64-bit drivers with 32-bit drivers.
Reopen any command prompt window and try running your perl script again.

Freeradius 3.0.11 Postgresql

I'm trying to configure freeradius 3.0.11 with postgresql but I'm having an issue with the driver listed in the sql file inside of 'mods-enabled.' The driver I am listing is 'rlm_sql_postgresql.'
When I run 'radiusd -X' I get the error:
Could not link driver rlm_sql_postgresql: dlopen(/usr/local/Cellar/freeradius-
server/3.0.11/lib/rlm_sql_postgresql.dylib, 6): image not found
Make sure it (and all its dependent libraries!) are in the search path of your system's ld
/usr/local/Cellar/freeradius-server/3.0.11/etc/raddb/mods-enabled/sql[20]: Instantiation failed for module "sql"
When I look in the folder 3.0.11/lib there is indeed no such file called rlm_sql_postgresql.dylib.
Any ideas on this? Should I be generating this file somehow?
It means when configure was run for freeradius, it didn't pick up libpq.
Apparently brew install postgresql will pull down libpq and its development headers.
Remove freeradius, install postgresql, install freeradius with brew install --build-from-source freeradius-server
It should (unless the homebrew people have gone out of their way to break things), install the postgresql driver.

Problems installing/compiling DBD::mysql on OpenSuSE 10

I am getting a bunch of compile errors when I try to install the MySQL DBD::mysql Perl library. I am trying to install this library on OpenSuse linux (SUSE Linux Enterprise server 10 (x86_64) version 10, patch level 4)
The install fails when trying to compile dbdimp.h. There are hundreds of complile errors but I have reason to believe they all stem from the first 3:
dbdimp.h:23:49: error: mysql.h: No such file or directory
dbdimp.h:24:45: error: mysqld_error.h: No such file or directory
dbdimp.h:26:49: error: errmsg.h: No such file or directory
I believe that the reason I am getting the errors above is that I have no MySql Client installed. I do not know how to install mysql client (I believe I am supposed to get some version of libmysqlclient).
I am brand new to opensuse and vaguely familar with installing packages on Linux in general have used yum, yast, apt-get on ubuntu + centOS previously but the only package manager tools that seem to be on OpenSuse 10 are rpm and zypper. I have not managed to install the required mysql client using either of these. If anyone knows how to install MySql Client to resolve my issue I would greatly appreciate any recomendations
Thanks
You need to install MySQL or the MySQL client libraries, either through your system's package manager or by following the installation instructions from the source code.
It sounds like your question is really "How do I install MySQL on OpenSuse", which would be more appropriate for one of the other StackExchange sites.
I was able to resolve this to a point. In my original question, I stated that I had tried using YAST but that it had not worked. In fact, I did not fully explore the YAST install option but when I did, I managed to download install the required librarys by following an article I found (http://adminramble.com/install-mysql-yast/#chitika_close_button)
I was able to open the YAST GUI in the terminal window (not an X-window display) and navigate through the "software management" section wherein I was able to do a search for MySql. Amoung the search results were mysql client libraries, which I then selected and hit "Accept". The installation started and completed successully.
In order to complile the PERL DBD::mysql module, I had to create a new makefile with the ccflags specified so that the header files could be found:
perl Makefile.PL --cflags -I/usr/include/mysql
I say "to a point" at the top of this comment because I then ran into further problems compiling but my original issue posted has been partially resolved and getting this far may help someone else who is experiencing the same problem. Will update if I get a solution to the compile problem.

Where do I get libpq source?

I want to write application which uses Postgresql as DBMS.
To write client application do I need libpq library and header files?
If yes where I would get libpq library and header files.
Libpq is included in the full PostgreSQL source code. You can use just libpq without the rest of PostgreSQL, but must download the full package.
You can download it from the PostgreSQL Downloads page.
Once you extract the full package it is inside src\interfaces\libpq.
The PostgreSQL installation guide details how to install only the client libraries in the Installation section, under Client-only installation.
Libpq documentation is also available.
In postgresql sources, src\interfaces\libpq.
And yes, it is possible to compile only the libpq.
get the lipq from repo, {for debian} :
sudo apt-get install libpq-dev
I was also facing this issue but didn't got a clear answer:
This issue clearly states that while installing diesel-cli system is not able to locate libpq.lib
First of all you should have a Postgres installed on your machine.
Also diesel require visual c++, thus download and install it if not already, the size of setup will be ~5gb.
Once above installations are done you need to setup environment variables:
In my case path of Postgres installation is C:\Program Files\PostgreSQL thus add 2 environment variable path under User variables add new in Path where your libpq.lib is located in my case it is available in both C:\Program Files\PostgreSQL\12\lib and C:\Program Files\PostgreSQL\12\bin
Once this is added create one more environment variable PQ_LIB_DIR and set path as shown below
Note: Once done re-trigger the installation command in a new cmd window
Source: pq-sys and github-solution
For Windows users, it's in (version may be different)
C:\Program Files\PostgreSQL\11\lib
There you find libpq.lib. Provide this directory to Linker input.
Don't forget to include C:\Program Files\PostgreSQL\11\include directory for include directories.
I fix this problem reccently. This is a solution if you don't want to install Postgres in you windows.
At first, you need download Postgres Binaries. The version I download is 13.6, but it's seems like any version is fine.
Unzip the zip file.Copy libpq.lib from pgsql\lib to shomewhere like C:\Program Files\Postgres\lib.
Execute the following command in cmd window.
setx PQ_LIB_DIR "{where_you_copy_to}"
Open a new cmd windows and install diesel_cli
cargo install diesel_cli --no-default-features --features postgres
In linux vertify you get the libpq.
1st, there is an app: pg_config: https://www.postgresql.org/docs/current/app-pgconfig.html
after you found out the pg_config absolute bin path.(if you installed multi version of postgressql) Then You can get
--includedir
Print the location of C header files of the client interfaces.
--libdir
Print the location of object code libraries.
Then try to compile/build some example code: https://www.postgresql.org/docs/current/libpq-example.html
Some common failure example: https://www.postgresql.org/docs/current/libpq-build.html
You can install Postgres locally from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads but select only "Command line tools" for install.
After that, you can found libpq.dll in C:\Program Files\PostgreSQL\15\bin