Hello,
I have a project where I need to connect to a Oracle database to perform basic SQL queries on it.
I did find a C library called OCIlib and I'm trying to write a static lib in C (using OCIlib) to connect FreeBasic to the oracle database.
However I am not having much luck building this (ugly hack) bridge between the Oracle database and FreeBasic.
Is it possible for someone to help me connect directly to the Oracle database from FreeBasic?
Possibly share some existing functions?
As long as I can perform simple INSERTS and SELECT queries (like fetching ints and strings) then I'll be fine
Thanks in advance, Pim
Connecting to a Oracle database directly from FreeBasic
-
- Posts: 54
- Joined: Jun 29, 2014 17:15
Re: Connecting to a Oracle database directly from FreeBasic
I just had a quick look for existing methods to connect to an Oracle DB from C and found:
OCI: http://www.oracle.com/technetwork/datab ... 90945.html
OCILib: http://vrogier.github.io/ocilib/
The former (Oracle Call Interface) is a rather low-level interface which is probably not that easy to program, but the latter is an abstraction of OCI which is probably simpler to use. Other interfaces like OCCI (for C++) unfortunately can't be used directly (= without wrapper) with FreeBasic as of now. Thus I'd go with OCILib, as you're already doing according to your initial post.
However, to use the OCILib in FreeBasic you "just" have to create header files for FreeBasic, that declare all the methods and data structures you need. So you don't have to write any C code; C libraries can be used directly from FreeBasic. See
http://www.freebasic.net/wiki/wikka.php ... ngCreation for details. I'd recommend starting with a translation tool like dkl's fbfrog.
Maybe I can build a simple example on the weekend, if you have troubles with creating and using FB Headers.
OCI: http://www.oracle.com/technetwork/datab ... 90945.html
OCILib: http://vrogier.github.io/ocilib/
The former (Oracle Call Interface) is a rather low-level interface which is probably not that easy to program, but the latter is an abstraction of OCI which is probably simpler to use. Other interfaces like OCCI (for C++) unfortunately can't be used directly (= without wrapper) with FreeBasic as of now. Thus I'd go with OCILib, as you're already doing according to your initial post.
However, to use the OCILib in FreeBasic you "just" have to create header files for FreeBasic, that declare all the methods and data structures you need. So you don't have to write any C code; C libraries can be used directly from FreeBasic. See
http://www.freebasic.net/wiki/wikka.php ... ngCreation for details. I'd recommend starting with a translation tool like dkl's fbfrog.
Maybe I can build a simple example on the weekend, if you have troubles with creating and using FB Headers.