views:

182

answers:

6

So here is the story. I have this device that uses Linux and more open source tools(btw its an ARM). And I was given the task of creating some magic cashier application with it.

I have done it and now my boss have made a new request. He wants me to make that stuff(the device) connect to a remote database(preferably Oracle). So thats what I started doing with the light version of oracle instant client. Everything is fine and cool until I ran my first hello world:

#include <occi.h>

using namespace oracle::occi;

int main(){
  Environment *env = Environment::createEnvironment();
  Connection *conn = env->createConnection("HR", "password");
  env->terminateConnection(conn);
  Environment::terminateEnvironment(env);
  return 0;
}

Linking against occi, clntsh, thread; And setting the library search path, along other stuff to: "${workspace_loc:/OracleTest/instantclient_10_2}" that is the directory that holds my .so files;

Here is the compilation command:

ucfront-g++ -Wl,-elf2flt="r" -static -o OracleTest  ./main.o   -locci -lclntsh -lthread -L/usr/local/arm-elf/lib -L"C:\workspace\OracleTest\instantclient_10_2" -L/usr/local/fit-libs/lib

And here is the error:

/usr/local/arm-elf/bin/ld.real: cannot find -locci collect2: ld returned 1 exit status

And there are a few things that I would like to mention:

1- I'm running windows and compiling this for linux, the instant client version that I've downloaded is for linux x86(No Idea if that will work or if it could be the source of the problem).

2- I'm using a modified version of eclipse to develop, specific for that device.

3- I have no idea if I should move those Oracle libs to the device after the compilation, so if anyone could give me orientation on that, I would be very thankful.

TLDR: I wan't to compile the above code but it fails to link, help, please!

EDIT:

To the two first answers, no I haven't found any specific ARM libraries, I don't think there are any.

Here is the link if anyone can find anything that resemble an ARM distribution I would be thankful. There are two RISC distribution but I don't know if they are compatible with ARM :

Instant Client for HP-UX PA-RISC (64-bit)
Instant Client for HP-UX PA-RISC (32-bit)
+1  A: 

If you do not have ARM versions of the Oracle library, you're totally out of luck there and would need to get one (perhaps there is a free driver?) or implement the wire protocol manually.

David Schmitt
A: 

Well i'm pretty sure that you'd need the windows version of the Oracle Client if you're running on a windows machine.

David Aldridge
And how would I make it run in the linux that I'm deploying? Will there be any hard dependencies between the libraries and the compiled software?
awregan
A: 
  1. You need to move the -L arguments before the -l arguments.
  2. You'll need ARM libraries to run on the device, not x86 libraries, no idea if Oracle provides those.
  3. You probably don't want to have the device directly accessing the database. It would be better to stick a middle-tier server in the stack, and have the devices talk to that (over XML-RPC or other RPC protocol).
Douglas Leeder
The third option would make my life much easy but, why don't I wan't the devices talking to the database directly?
awregan
http://en.wikipedia.org/wiki/Multitier_architectureBasically it allows independence; allowing both the database and the endpoints to be replaced without requiring the other to change. It avoid precisely the problem you are having - needing proprietary libraries for your devices.
Douglas Leeder
+1  A: 

Erm... is there an instant-client (or any Oracle client) for Linux+ARM at all? I don't see one on the downloads page.

If not, you will have to use ODBC, or another database that has an open-source client you can compile.

bobince
+1  A: 

How about using java with a jdbc-driver ? Oracle-thin-driver is pure-java so it should work on arm. If you cannot write a pure java-app and need to use other libraries on your arm-device, you can use JNI-calls from java to use native-arm libraries.

tjin
A: 

Your best chances are either to use Java and the JDBC driver, as suggested by tjin, or completely forget the idea of directly connecting to the database; create a web service on the server and use that instead.

ammoQ