Search This Blog

Tuesday, July 05, 2005

connecting to derby using servlets in apache tomcat

for accessing derby

copy derby.war from DERBY_INSTALL/lib to TOMCAT_INSTALL/webapps
and db2jcc*.jar (2 files) from DERBY_INSTALL/lib to TOMCAT_INSTALL/common/lib

Friday, July 01, 2005

PHP odbc functions

problem with odbc_num_rows and odbc_fetch_array in linux. (i use Redhat 9)

on most *nix machines with unixODBC driver it returns -1 in both cases ie. if u find some rows or if u dont find any row. so u cant to use odbc_num_rows to check whether a row exists or not
for eg you can use
if(odbc_num_rows($result) > 0)
do something
on windows platform.

but for *nix u cant.

so instead use the following function

function better_odbc_num_rows($result)
while($temp = odbc_fetch_into($result, &$counter))
return $count;

and use
if(better_odbc_num_rows($result) > 0)
do something


in *nix

odbc_fetch_array does not exist on some machines. so use

odbc_fetch_into($result, $array);