Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

Gentoo and DB2

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
23 posts • Page 1 of 1
Author
Message
dman777
Veteran
Veteran
Posts: 1004
Joined: Wed Jan 10, 2007 6:12 am

Gentoo and DB2

  • Quote

Post by dman777 » Fri Jan 25, 2008 3:37 pm

Does anyone know if DB2 will work on Gentoo? I know IBM doesn't officially support Gentoo, but I heard it is possible from someone else. I would like to know if anyone has done it themselves or can offer any suggestions?
Top
timeBandit
Bodhisattva
Bodhisattva
User avatar
Posts: 2719
Joined: Fri Dec 31, 2004 1:54 am
Location: here, there or in transit

  • Quote

Post by timeBandit » Fri Jan 25, 2008 3:43 pm

DB2 client or server? I managed--with considerable aggravation IIRC--to get the client installed & working on Gentoo some years ago. As for the server, I couldn't tell you.
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Top
dman777
Veteran
Veteran
Posts: 1004
Joined: Wed Jan 10, 2007 6:12 am

  • Quote

Post by dman777 » Fri Jan 25, 2008 3:50 pm

No, it's for my laptop as a server. I just want to use it to learn the fundamentals for DB2. I have a big feeling from what you said it would be a horrible experience to try and get it to work. It stinks because I am just getting into Linux and I wanted to go with Gentoo, but running DB2 on Linux is my priority so I'll have to go with Red Hat or Ubuntu(I'm a fan neither).
Top
timeBandit
Bodhisattva
Bodhisattva
User avatar
Posts: 2719
Joined: Fri Dec 31, 2004 1:54 am
Location: here, there or in transit

  • Quote

Post by timeBandit » Fri Jan 25, 2008 4:18 pm

A big issue, as I recall, is that the DB2 client--and I expect the server is no different--wants to install a *ton* of files in various locations all over the filesystem. I wanted it all under /opt, for two reasons: 1) I had no time or inclination to wrap the installer in an ebuild, so Portage would know about the files; 2) I wanted to remove it cleanly, no matter what--I don't trust most stand-alone installers to clean up after themselves. :x At least for the client version I used, it was difficult or impossible to force it to install under an alternate root.

If Red Hat and Ubuntu are supported platforms for DB2, you'd be much better off, because it will presumably be installed from a proper package for the OS, not by IBM's install script. That way, the package manager knows about all the files installed and you don't get collisions with other packages.
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Fri Sep 12, 2008 2:42 pm

Hi guys,
I would know how I could connect with a DB2 installed on a AS400 for make a project with PHP.
I want to make the point that I'm a noob on database DB2

Now I follow this wiki
http://sqls.net/wiki/HOWTO:_Connect_to_ ... B_with_PHP

But I have some questions
1. Is DB2 Connect PE free?
1.1 If is it not I can connect to DB2 only with DB2 Client?
2. If I install only IBM DB2 Driver for ODBC and CLI, could I connect with DB2 via ODBC?


thanks
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Sat Sep 13, 2008 11:42 am

We use the linux ODBC driver (free) from IBMs web site. If you are doing any terminal (AKA "green screen") work another benefit is that the ODBC packaige includes a relatively nice 5250 terminal emulator (I like it better than the tn5250 package).

Note that if you run a busy web site (we have several) you may need to tweak how many apache instances you are running, and whether to use persistent connections or not. Note also that I think there is an ODBC licensed program that has to be on the iSeries box - don't know if it is free or not (or even if it is a separate licensed program, or comes with DB2). I cannot remember what subsystem they run under, but the ODBC handlers are jobs called QZDASOINIT - so if you see some using WRKACTJOB then the iSeries already has ODBC on it..

When we originally installed the linux ODBC drivers they were only available for 32-bit - I do not know if that is still true or not.
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Sun Sep 14, 2008 8:42 am

Today I'm not at work... so I can't do another attempts. but I have another question:
Do you can use the native API on PHP on only ODBC API?
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Mon Sep 15, 2008 9:31 am

Hi,
I download (from http://www-01.ibm.com/support/docview.w ... wg21255390) and install the ODBC driver for DB2 but I don't know why I can't connect to server. :cry: :cry:

this is my .odbc.ini file

Code: Select all

[db2test]
Description     = Prova DB2 con Driver ODBC
Driver          = /opt/clidriver/lib/libdb2.so
and db2cli.ini

Code: Select all

[db2test]
dbalias=db2_test
uid=<user>
pwd=<password>
protocol=tcpip
database=<databsse_db2>
hostname=128.1.1.1
ServiceName=446

When I try to connect to database....

Code: Select all

[08001][unixODBC][IBM][CLI Driver] SQL1013N  The database alias name or database name "DB2TEST" could not be found.  SQLSTATE=42705

[ISQL]ERROR: Could not SQLConnect
If I can connect to DB2 only with ODBC driver, I'll have to set some environment variables?
What I have to do?
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Wed Sep 17, 2008 6:13 pm

Example entry from /etc/unixODBC/odbc.ini:

Code: Select all

[RETAILPROD]
Description = Production retail
Driver = iSeries Access ODBC Driver
System = INTRA1
UserID =
Password =
Naming = 1
DefaultLibraries = , TXTSHOP TXTSRCH
Database =
ConnectionType = 0
CommitMode = 2
ExtendedDynamic = 1
DefaultPkgLibrary = QGPL
DefaultPackage = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression = 1
LibraryView = 0
AllowUnsupportedChar = 0
ForceTranslation = 0
Trace = 0
Note that IBM's odbc package includes a program to help make one of these...
Also INTRA1 is the name of the iSeries we want to connect to, and in this case I want TXTSHOP and TXTSRCH libraries on my liblist when executing statements (ie do not have to qualify an tables accessed that are in those two libraries).

To connect we have a helper class, but the connection code itself looks like:

Code: Select all

if (we want to use persistent connections)$conn = odbc_pconnect('RETAILPROD', 'login user name', 'login password');
else $conn = odbc_connect('RETAILPROD', 'login user name', 'login password');
if (!$conn) { ... error handling }

if (we do not want to auto commit) {
    if (!odbc_autocommit($conn, false)) { ... error handling }
}

// OK - we connected successfully. To execute a statement:

$rs = odbc_do($conn, "SELECT * FROM SOMETABLE FOR READ ONLY");
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Thu Sep 18, 2008 7:03 am

Ok, two days ago I installed iSeries Access for Linux and installed the relative ODBC driver with this command:

Code: Select all

# odbcinst -i -d -f /opt/ibm/iSeriesAccess/unixodbcregistration
After witch I configurated my odbc.ini with the correct parameter and I have tested the connection with isql and DataManager and it work fine. Now I can see the tables, execute the querys and so on.

The problem now I have is on PHP! :cry: :cry: , I have tryed the connection with the odbc_pconnect but when I load the page I have this error message:

Code: Select all

Warning: odbc_pconnect() [function.odbc-pconnect]: SQL error: [unixODBC][IBM][iSeries Access ODBC Driver]Missing system name needed for connection., SQL state S1000 in SQLConnect in /var/www/localhost/htdocs/db2_test3.php on line 32

PS: 1. Is it possible use the IBM DB2 Driver for ODBC and CLI without buy a connect licence?
PS: 2. Is it possible use the DB2 function (ie db2_connect) with iSeries Access for Linux?
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Thu Sep 18, 2008 12:55 pm

Check your php.ini file for apache (is in /etc/php directory) - there are settings for enable/disable persistent connections, etc.

I don't manage the iSeries end of things (for licensed programs kinda stuff), so can't say about requirements. And I have only used odbc to a 400, not pdo_xxx, db2_xxx or anything else.
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Thu Sep 18, 2008 1:05 pm

This is the section ODBC in my php.ini:

Code: Select all

[ODBC]
;odbc.default_db    =  Not yet implemented
;odbc.default_user  =  Not yet implemented
;odbc.default_pw    =  Not yet implemented

; Allow or prevent persistent links.
odbc.allow_persistent = On

; Check that a connection is still valid before reuse.
odbc.check_persistent = On

; Maximum number of persistent links.  -1 means no limit.
odbc.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
odbc.max_links = -1

; Handling of LONG fields.  Returns number of bytes to variables.  0 means
; passthru.
odbc.defaultlrl = 4096

; Handling of binary data.  0 means passthru, 1 return as is, 2 convert to char.
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
; of uodbc.defaultlrl and uodbc.defaultbinmode
odbc.defaultbinmode = 1
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Thu Sep 18, 2008 5:53 pm

"Missing system name" sounds like you did not put the 400's tcp/ip system name in the DSN section in odbc.ini. For example in mine the system name is INTRA1, and I can ping/telnet into the 400 using the address "INTRA1".
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Thu Sep 18, 2008 5:56 pm

Oh crap - I just re-read you messages and see you are running DB2 on linux; all my info was about connecting to DB2 running on the IBM iSeries (was called AS400) mini-computers. I can't help with running DB2 on linux, although I would REALLY THINK that all the same info applies. The system name is the domain name - can be dotted (eg 127.0.0.1), or can be a domain name (eg localhost).

And I would get normal connections (odbc_connect) running before I worried about persistent connections.
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Fri Sep 19, 2008 7:12 am

Sorry, maybe I don't explain my problem very well
My server DB2 is installed on AS400! And I try to connect from a Linux server!

Now I can connect with isql or DataManager but not with PHP! and I use the same DSN.
In my network, the AS400 have got 128.1.1.1 as ip address and I can ping it.

However my DSN is this:

Code: Select all

[db2_test]
Description     = iSeries Access ODBC Driver
Driver          = iSeries Access ODBC Driver
System          = 128.1.1.1
UserID          =
Password        =
Naming          = 1
DefaultLibraries= <my_library>
Database        = <my_database>
ConnectionType  = 0
CommitMode      = 2
ExtendedDynamic = 1
DefaultPkgLibrary       = <my_library>
DefaultPackage          = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression    = 1
LibraryView             = 0
AllowUnsupportedChar    = 0
ForceTranslation        = 0
Trace                   = 0
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Sun Sep 28, 2008 6:12 pm

Are you trying to connect using:

Code: Select all

$conn = odbc_pconnect("db2_test", "VALIDUSER", "PASSWORD");
Here, "VALIDUSER" is quoted user name of a valid account on the AS400, and "PASSWORD is quoted user's password?

I can't validate the rest of the DSN values right now - am not at work. When you get it working, note that the Naming = 0/1 toggles between system naming convention (slash, such as "select * from COLLECTION/TABLE") versus SQL naming convention (dot, such as "select * from COLLECTION.TABLE"). We don't use SQL package stuff, so I can't say about those values.

I am pretty sure that the DefaultLibraries is supposed to look like:

Code: Select all

Default Libraries= , FIRSTLIB SECONDLIB THIRDLIB
Important thing here is the leading comma. It is setting up the library list the SQL will execute under - very important if you have RPG user defined functions or procedures (at least they way our developers write RPG programs).

To make a little more secure We actually use the odbc.default_user and odbc.default_pw in the apache config file and then read it in the code before opening a connection. Cannot directly quote the code (again, not at work right now) but something like:

Code: Select all

.. in the apache config for a particular app
php_value odbc.default_user "VALIDUSER"
php_value odbc.default_pw "PASSWORD"
... rest of apache config
And in our include file that wraps database access:

Code: Select all

$uid = ini_get("odbc.default_user");
$pwd = ini_get("odbc.default_pw");
$conn = @odbc_connect($the_dsn, $uid, $pwd);
...
This way we don't have the name/password of an account in a file that apache can serve (did not start this way, but one person screwed up a config and people were able to download a file with the name/password in it; changed the account on the AS400s and redid all code to get as described above).
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Tue Sep 30, 2008 8:33 am

I also try with your DSN example (with my settins) but it doesn't work and the error is always the same. Now I tryed to install System i Access under ubuntu but with the same result.

Is it possible that I haven't some php features? (because with isql I can connect without any problem!)

:evil: :evil: :evil: :evil:
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Sun Oct 05, 2008 9:23 pm

I assume you have the odbc USE flag set for php - without it you probably wouldn't even have the odbc_connect() or odbc_pconnect() functions...
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Tue Oct 07, 2008 5:41 pm

pdr wrote:I assume you have the odbc USE flag set for php
Yes I have set this flag and I can connect to other database like mysql with odbc function
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Tue Oct 07, 2008 6:18 pm

I'm at work now, so I can confirm that your odbc.ini entry looks likes ours - note that we don't have our own packages and use the default that you have - A/DEFAULT(IBM),2,0,1,0,512. However, our DefaultPkgLibrary is QGPL - you may need that to support that DefaultPackage.

If you can connect to the 400 using odbc via other packages, then that confirms it is not a odbc setup problem, but instead something with PHP. If you haven't tested it then you can use /opt/ibm/iSeriesAccess/bin/cwbrunsql like so:

Code: Select all

/opt/ibm/iSeriesAccess/bin/cwbrunsql /DSN:<your DSN name> /USER:<400 user name> /PASSWORD:<400 user password> /I:<path to file containing SQL statement>
I ran this with /home/sdpr/test.sql which contained:

Code: Select all

select * from STATES for read only
Where STATES is a table accessible from my DSN. It did not actually print out the result set, but it ran OK. So if you can run such a set up then there is something up with your PHP and we can go from there.
Top
falko
Apprentice
Apprentice
User avatar
Posts: 242
Joined: Fri Dec 03, 2004 7:41 am
Location: Rovereto (TN) Italy

  • Quote

Post by falko » Wed Oct 08, 2008 7:09 am

pdr wrote:... A/DEFAULT(IBM),2,0,1,0,512. However, our DefaultPkgLibrary is QGPL...
I also try with this parameter but It doesn't change anything

Anyway it's strange that php (with odbc function) can connect to MySQL but not with DB2
Io non sarò mai nessuno ma... nessuno sarà mai come me. (Jim Morrison)

A ciacere no se sgonfa done

Gentoo on: Lenovo R500
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Wed Oct 08, 2008 8:55 pm

Did you try cwbrunsql? Could be a network thing..
Top
rahulvk
n00b
n00b
Posts: 1
Joined: Tue Jun 08, 2010 12:19 pm

Linux and DB2

  • Quote

Post by rahulvk » Tue Jun 08, 2010 12:33 pm

Hi,

I am also trying to connect with DB2 from PHP on Linux. I installed the iSeriesAccess Driver using iSeriesAccess-5.4.0-1.6.x86_64.rpm. It connects and works fine if I run PHP in CLI mode, but, when I run PHP via Apache, it says

Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC][IBM][iSeries Access ODBC Driver]Communication link failure. comm rc=10013 - CWBCO1003 - Sockets error, function returned 10013, 192.168.100.50, SQL state 08S01 in SQLConnect

I then removed this driver and tried installing a new one using iSeriesAccess-6.1.0-1.0.x86_64.rpm. This also works fine if I run PHP in CLI mode, but, when I run PHP via Apache, it shows a blank page.

I checked the apache error log ... and it has line that says....


[Tue Jun 08 08:02:02 2010] [notice] child pid 20580 exit signal Segmentation fault (11)

Can anyone help?
Top
Post Reply

23 posts • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic