You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Nicolas Dufour <ni...@neometsys.fr> on 2005/11/04 13:50:22 UTC

Re: Has anyone tried to write a C app and connect to Derby?

Michael Segel wrote:
> While this seems weird, there is a serious reason behind this.
>
> I wouldn't expect anyone to embed Derby in to a C app, however, with the 
> network interface/framework... Well you get the idea.
>
> -G
>
>   
Hello Michael

My java program has parts in C and access to derby from C but with the 
help of java methods using JNI.
It seems the only solution ...

Nicolas

Re: Has anyone tried to write a C app and connect to Derby?

Posted by Dan Scott <de...@gmail.com>.
On 11/4/05, Jean T. Anderson <jt...@bristowhill.com> wrote:
> Dan Scott wrote:
> > ...
> > (Shameless plug / full disclosure section: I contributed some chapters
> > on using Derby as a network server with Perl, PHP, and Python to the
> > newly released "Apache Derby: Off to the Races" book from IBM Press
> > ...
>
> do you have a link for this? I've been compiling a list here:
>
> http://db.apache.org/derby/papers/index.html#Articles
>
> ummm, I guess I should label that section "Articles and Books".  :-) At
> any rate, if you have a link to the book title anywhere, I'll add it to
> the Derby web site.

Thanks a lot Jean! I suppose the "official home" would be:
http://www.ibmpressbooks.com/title/0131855255

Dan

Re: Has anyone tried to write a C app and connect to Derby?

Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Dan Scott wrote:
> ...
> (Shameless plug / full disclosure section: I contributed some chapters
> on using Derby as a network server with Perl, PHP, and Python to the
> newly released "Apache Derby: Off to the Races" book from IBM Press
> ...

do you have a link for this? I've been compiling a list here:

http://db.apache.org/derby/papers/index.html#Articles

ummm, I guess I should label that section "Articles and Books".  :-) At 
any rate, if you have a link to the book title anywhere, I'll add it to 
the Derby web site.

  -jean

Re: Has anyone tried to write a C app and connect to Derby?

Posted by Dan Scott <de...@gmail.com>.
Yes, I used the DB2 CLI driver -- there's really no difference between
programming for DB2 CLI versus programming for ODBC. The DB2
Information Center
(http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/ad/r0000553.htm)
documents the CLI API pretty well.

Most of the work I have done has been on Linux. To compile a CLI/ODBC
app you need the headers shipped with the DB2 Application Development
Client (free download from
http://ibm.com/db2/udb/support/downloadv8.html).

The primary reason I have been going this route was so I could help
develop and test the ibm_db2 extension for PHP against Derby as well
as against DB2. Works quite nicely, if I do say so myself...

Dan
(Shameless plug / full disclosure section: I contributed some chapters
on using Derby as a network server with Perl, PHP, and Python to the
newly released "Apache Derby: Off to the Races" book from IBM Press
and I occasionally write about my experiences with Derby, DB2, PHP,
and various other things on my blog at http://coffeecode.net.)


On 11/4/05, Michael Segel <ms...@segel.com> wrote:
> On Friday 04 November 2005 08:25, you wrote:
> Thanks,
>
> That was what I was looking for.
> I'm more interested in the CLI programs.
>
> Since CLI is a generic term, which library set are you using?
> I'm going to assume DB2. If so, which driver did you use?
>
> I think that this is definitely an under exploited use of Derby.
>
> Since Derby is released under Apache, there is a lot of freedom with
> minimal/no risk in use, and no additional cost.
>
> IMHO, this makes it a real competitor in the SMB marketplace.
>
> Thx,
>
> -G
>
> > Yep, I've written ODBC and CLI programs that connect to Derby via the
> > network server.
> >
> > It's not really odd at all. In fact, that's how PHP, Perl, Python, etc
> > all connect to Derby -- the corresponding DB2 driver they rely on is
> > basically a C application. You just approach Derby as a regular
> > database server that just happens to be written in Java, rather than a
> > Java application that happens to be a database server.
> >
> > Dan
> >
> > On 11/4/05, Nicolas Dufour <ni...@neometsys.fr> wrote:
> > > Michael Segel wrote:
> > > > While this seems weird, there is a serious reason behind this.
> > > >
> > > > I wouldn't expect anyone to embed Derby in to a C app, however, with
> > > > the network interface/framework... Well you get the idea.
> > > >
> > > > -G
> > >
> > > Hello Michael
> > >
> > > My java program has parts in C and access to derby from C but with the
> > > help of java methods using JNI.
> > > It seems the only solution ...
> > >
> > > Nicolas
>
> --
> Michael Segel
> Principal
> MSCC
>

Re: Has anyone tried to write a C app and connect to Derby?

Posted by Dan Scott <de...@gmail.com>.
Glad you figured it out!

On 11/5/05, James Pannozzi <ji...@gmail.com> wrote:
> Problem was located - Apache config
>  file wrongly set php ini directory to c:\php
>  instead of c:\windows.
>
>  Please disregard db2_undefined function comments!
>
>  Thanks
>  J. Pannozzi
>
>
> On 11/5/05, James Pannozzi <ji...@gmail.com> wrote:
> > No problem connecting to Derby from C...vial CLI?
> >
> >
> ************************************************************
> > PROBLEM WAS FOUND - php ini DIRECTORY was
> > set to c:\php in apache conf file.
> > Please disregard db2_ "undefined function"
> > comments
> >
> ***********************************************************
> >
> > Well good, then I'm hoping someone could tell me
> > why I can get PHP to talk to Derby via unified ODBC
> > but when I try to use functions such as db2_connect,
> > I get "undefined function".   If I change it to
> > "odbc_connect" it sees it OK but does not
> > recognize my table names.
> >
> > (windows xp, Apache, PHP 5, Derby 10.1)
> >
> > I've checked my php.ini about 48 times and the
> > extensions for db2 are there.   I've installed
> > the IBM DB2 Lite Client and I've even tried copying
> > the php_db2 dll to c:\windows\system32 but it still
> > does not recognize any functions begining with "db2_".
> > I also have the appropriate settings in my apache conf
> > file.
> > Could it be that the version of php I installed (from the zip file, not
> > the installer) does not have support for db2 compiled into it?
> > How do you tell.
> >
> > Settings I'm using follow:
> >
> > From my php.ini
> >
> > ;extension=php_xmlrpc.dll
> > ;extension=php_xsl.dll
> > ;extension=php_yaz.dll
> > ;extension=php_zip.dll
> > ibm_db2.instance_name=DB2
> > ibm_db2.instance_home="C:\Program
> Files\IBM\Cloudscape_10.1"
> > extension=php_ibm_db2.dll
> > extension=php_mysql.dll
> >
> >
> >
> >
> >
> >
> >
> >
> > On 11/4/05, Dan Scott <denials@gmail.com > wrote:
> > > Yep, I've written ODBC and CLI programs that connect to Derby via the
> > > network server.
> > >
> > > It's not really odd at all. In fact, that's how PHP, Perl, Python, etc
> > > all connect to Derby -- the corresponding DB2 driver they rely on is
> > > basically a C application. You just approach Derby as a regular
> > > database server that just happens to be written in Java, rather than a
> > > Java application that happens to be a database server.
> > >
> > > Dan
> > >
> > > On 11/4/05, Nicolas Dufour < nicolas.dufour@neometsys.fr> wrote:
> > > > Michael Segel wrote:
> > > > > While this seems weird, there is a serious reason behind this.
> > > > >
> > > > > I wouldn't expect anyone to embed Derby in to a C app, however, with
> the
> > > > > network interface/framework... Well you get the idea.
> > > > >
> > > > > -G
> > > > >
> > > > >
> > > > Hello Michael
> > > >
> > > > My java program has parts in C and access to derby from C but with the
> > > > help of java methods using JNI.
> > > > It seems the only solution ...
> > > >
> > > > Nicolas
> > > >
> > > >
> > > >
> > >
> >
> >
>
>

Re: Has anyone tried to write a C app and connect to Derby?

Posted by James Pannozzi <ji...@gmail.com>.
Problem was located - Apache config
file wrongly set php ini directory to c:\php
instead of c:\windows.

Please disregard db2_undefined function comments!

Thanks
J. Pannozzi

On 11/5/05, James Pannozzi <ji...@gmail.com> wrote:
>
> No problem connecting to Derby from C...vial CLI?
>
> ************************************************************
> PROBLEM WAS FOUND - php ini DIRECTORY was
> set to c:\php in apache conf file.
> Please disregard db2_ "undefined function"
> comments
> ***********************************************************
>
> Well good, then I'm hoping someone could tell me
> why I can get PHP to talk to Derby via unified ODBC
> but when I try to use functions such as db2_connect,
> I get "undefined function". If I change it to
> "odbc_connect" it sees it OK but does not
> recognize my table names.
>
> (windows xp, Apache, PHP 5, Derby 10.1)
>
> I've checked my php.ini about 48 times and the
> extensions for db2 are there. I've installed
> the IBM DB2 Lite Client and I've even tried copying
> the php_db2 dll to c:\windows\system32 but it still
> does not recognize any functions begining with "db2_".
> I also have the appropriate settings in my apache conf
> file.
> Could it be that the version of php I installed (from the zip file, not
> the installer) does not have support for db2 compiled into it?
> How do you tell.
>
> Settings I'm using follow:
>
> From my php.ini
>
> ;extension=php_xmlrpc.dll
> ;extension=php_xsl.dll
> ;extension=php_yaz.dll
> ;extension=php_zip.dll
> ibm_db2.instance_name=DB2
> ibm_db2.instance_home="C:\Program Files\IBM\Cloudscape_10.1"
> extension=php_ibm_db2.dll
> extension=php_mysql.dll
>
>
>
>
>
>
> On 11/4/05, Dan Scott <denials@gmail.com > wrote:
> >
> > Yep, I've written ODBC and CLI programs that connect to Derby via the
> > network server.
> >
> > It's not really odd at all. In fact, that's how PHP, Perl, Python, etc
> > all connect to Derby -- the corresponding DB2 driver they rely on is
> > basically a C application. You just approach Derby as a regular
> > database server that just happens to be written in Java, rather than a
> > Java application that happens to be a database server.
> >
> > Dan
> >
> > On 11/4/05, Nicolas Dufour < nicolas.dufour@neometsys.fr> wrote:
> > > Michael Segel wrote:
> > > > While this seems weird, there is a serious reason behind this.
> > > >
> > > > I wouldn't expect anyone to embed Derby in to a C app, however, with
> > the
> > > > network interface/framework... Well you get the idea.
> > > >
> > > > -G
> > > >
> > > >
> > > Hello Michael
> > >
> > > My java program has parts in C and access to derby from C but with the
> >
> > > help of java methods using JNI.
> > > It seems the only solution ...
> > >
> > > Nicolas
> > >
> > >
> > >
> >
>
>

Re: Has anyone tried to write a C app and connect to Derby?

Posted by James Pannozzi <ji...@gmail.com>.
No problem connecting to Derby from C...vial CLI?

************************************************************
PROBLEM WAS FOUND - php ini DIRECTORY was
set to c:\php in apache conf file.
Please disregard db2_ "undefined function"
comments
***********************************************************

Well good, then I'm hoping someone could tell me
why I can get PHP to talk to Derby via unified ODBC
but when I try to use functions such as db2_connect,
I get "undefined function". If I change it to
"odbc_connect" it sees it OK but does not
recognize my table names.

(windows xp, Apache, PHP 5, Derby 10.1)

I've checked my php.ini about 48 times and the
extensions for db2 are there. I've installed
the IBM DB2 Lite Client and I've even tried copying
the php_db2 dll to c:\windows\system32 but it still
does not recognize any functions begining with "db2_".
I also have the appropriate settings in my apache conf
file.
Could it be that the version of php I installed (from the zip file, not
the installer) does not have support for db2 compiled into it?
How do you tell.

Settings I'm using follow:

>From my php.ini

;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll
ibm_db2.instance_name=DB2
ibm_db2.instance_home="C:\Program Files\IBM\Cloudscape_10.1"
extension=php_ibm_db2.dll
extension=php_mysql.dll






On 11/4/05, Dan Scott <de...@gmail.com> wrote:
>
> Yep, I've written ODBC and CLI programs that connect to Derby via the
> network server.
>
> It's not really odd at all. In fact, that's how PHP, Perl, Python, etc
> all connect to Derby -- the corresponding DB2 driver they rely on is
> basically a C application. You just approach Derby as a regular
> database server that just happens to be written in Java, rather than a
> Java application that happens to be a database server.
>
> Dan
>
> On 11/4/05, Nicolas Dufour < nicolas.dufour@neometsys.fr> wrote:
> > Michael Segel wrote:
> > > While this seems weird, there is a serious reason behind this.
> > >
> > > I wouldn't expect anyone to embed Derby in to a C app, however, with
> the
> > > network interface/framework... Well you get the idea.
> > >
> > > -G
> > >
> > >
> > Hello Michael
> >
> > My java program has parts in C and access to derby from C but with the
> > help of java methods using JNI.
> > It seems the only solution ...
> >
> > Nicolas
> >
> >
> >
>

Re: Has anyone tried to write a C app and connect to Derby?

Posted by Dan Scott <de...@gmail.com>.
Yep, I've written ODBC and CLI programs that connect to Derby via the
network server.

It's not really odd at all. In fact, that's how PHP, Perl, Python, etc
all connect to Derby -- the corresponding DB2 driver they rely on is
basically a C application. You just approach Derby as a regular
database server that just happens to be written in Java, rather than a
Java application that happens to be a database server.

Dan

On 11/4/05, Nicolas Dufour <ni...@neometsys.fr> wrote:
> Michael Segel wrote:
> > While this seems weird, there is a serious reason behind this.
> >
> > I wouldn't expect anyone to embed Derby in to a C app, however, with the
> > network interface/framework... Well you get the idea.
> >
> > -G
> >
> >
> Hello Michael
>
> My java program has parts in C and access to derby from C but with the
> help of java methods using JNI.
> It seems the only solution ...
>
> Nicolas
>
>
>