This discussion is archived
3 Replies Latest reply: Jan 22, 2013 5:46 PM by Christian.Shay - Oracle RSS

Communication with database using TCP sockets connection

985481 Newbie
Currently Being Moderated
Hi all,

I am bit of a newbie when it comes to databases. In a project I realised over te passed few weeks, I communicated with an 11g database using an application I created with VS Express. It uses an ODBC connection. I now want to connect a PLC to the same database. These PLC's don't have the ability to install an ODBC client so I need something different.

I am easily able to open a TCP socket on the PLC and send data from there. I would like to know if I can start a TCP sockets connection with our 11g server and send all queries directly. The other (already suggested) option would be to have the PLC connect to a PC that reads this information and hands it over to the ODBC connector, but that would mean I need an extra PC just to 'translate'.

I have been searching these forums for socket, TCP and more and feel it is possible, but I need a good document as a reference to show/tell me how it's done.

Thanks in advance,

Marijn
  • 1. Re: Communication with database using TCP sockets connection
    Christian.Shay - Oracle Pro
    Currently Being Moderated
    The TCP/IP interface to Oracle is undocumented (and hugely complex anyway). You'll need to use a higher layer iterface or setup your own infrastructure.

    We need more information about what is available to you inside the PLC.

    Can you use Java? If so, perhaps use thin JDBC?

    Can you sent HTTP requests? If so you could set up your own Web services to handle this.

    If you can only use C or C++, Oracle has interfaces there too.. it's called OCI (Oracle Call Interface) and thats as close to the networking layer as you can get.

    Finally if you can use .NET Oracle has a Fully Managed Oracle Data Provider for .NET that you could use.

    But if all you can do is super low level network access and none of the above then you will need to set up an intermediary as you mentioned.
  • 2. Re: Communication with database using TCP sockets connection
    985481 Newbie
    Currently Being Moderated
    Thanks for your reply.

    I will check on the OCI. On the other hand, I know you say it's undocumented, but in'ts there any reference guide to the TCP/IP interface? All the PLC does is send a string and get an answer. There isn't much to it.

    Thanks,

    Marijn
  • 3. Re: Communication with database using TCP sockets connection
    Christian.Shay - Oracle Pro
    Currently Being Moderated
    982478 wrote:
    Thanks for your reply.

    I will check on the OCI. On the other hand, I know you say it's undocumented, but in'ts there any reference guide to the TCP/IP interface? All the PLC does is send a string and get an answer. There isn't much to it.

    Thanks,

    Marijn
    The interface I was speaking of is called "SQL*NET", it's packet level and very complex. Maybe we don't mean the same thing.

    The simplest way to go is to build your own middle tier, potentially using a web service if constructing HTML requests is easy enough for you.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points