Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ and Java objects communication

Tags:

java

c++

I need to establish a communication model between C++ layer and Java layer in my application. Initially, I planned to use SOAP with XML, but my clients are interested in setting up a database communication channel.

I am new to DB and not sure how to proceed. I would like to take your sincere suggestions on the implementation of communication in terms of objects between C++ and Java layer using database.

Thanks, Geet

like image 586
pankaj pankaj Avatar asked Sep 01 '10 16:09

pankaj pankaj


3 Answers

Database as communication? shudder

http://en.wikipedia.org/wiki/Database-as-IPC

This is an anti-pattern. Can you change your clients' minds?

Sockets are easier than a full blown SOAP interface.

like image 148
Starkey Avatar answered Oct 24 '22 03:10

Starkey


If you have 2 different applications communicating, sockets is the way to go. If your C++ layer is more like a library, you could also use JNI (http://en.wikipedia.org/wiki/JNI, google for tutorials).

like image 27
Cephalopod Avatar answered Oct 24 '22 05:10

Cephalopod


The choice of communication channel and blocking model is largely application dependent but sockets will probably work best if you don't need to worry about security. SSL/Mutual auth is your next step up.

I rolled my own, but I would use google protocol buffers if I had to do it all again. http://code.google.com/p/protobuf/

They seem to capture much of what people wanted out of ASN1 (but not all messed up) and let you do what people often try to do with serializing java Properties.

like image 1
Justin Avatar answered Oct 24 '22 04:10

Justin