

Code: Select all
[db2test]
Description = Prova DB2 con Driver ODBC
Driver = /opt/clidriver/lib/libdb2.so
Code: Select all
[db2test]
dbalias=db2_test
uid=<user>
pwd=<password>
protocol=tcpip
database=<databsse_db2>
hostname=128.1.1.1
ServiceName=446
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
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 = 0Code: 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");Code: Select all
# odbcinst -i -d -f /opt/ibm/iSeriesAccess/unixodbcregistration
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
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
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
Code: Select all
$conn = odbc_pconnect("db2_test", "VALIDUSER", "PASSWORD");Code: Select all
Default Libraries= , FIRSTLIB SECONDLIB THIRDLIBCode: 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 configCode: Select all
$uid = ini_get("odbc.default_user");
$pwd = ini_get("odbc.default_pw");
$conn = @odbc_connect($the_dsn, $uid, $pwd);
...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>Code: Select all
select * from STATES for read onlyI also try with this parameter but It doesn't change anythingpdr wrote:... A/DEFAULT(IBM),2,0,1,0,512. However, our DefaultPkgLibrary is QGPL...