Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2014
    Posts
    3

    Unanswered: Get Client Info, IP, OS Account

    Hello,

    PostgreSQL 9 on Linux Box.
    The Application on the Middle Tier will be able to get the Client's IP and OS Account. But how to store these info into to PostgreSQL, so that TRIGGER will be able to obtain them?

    The trigger on the Table will insert a record into our log table when the value changed in some columns with new and old values. And also need to know the Client IP and OS Account.

    inet_client_addr() did not give me the Client IP, instead, middle tier IP.

    Thanks in advance!!!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I would code the middle tier so that it would forward the client IP and OS Account as data to the database.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Apr 2014
    Posts
    3
    Hello Pat,

    Thank you very much for your reply!!!
    The Middle Tier is able to get these Client Info, but how to forward them to the database, so that the Trigger can obtain them during that session??

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Without knowing a lot more about your server architecture and the software you have written for your application server I don't know how to be more specific, so I'll try to explain the process in a different way...

    Your application server gets some data used by your application. This data can come from a web page, a SOAP or other API stream, a "fat client", or some other way. The mechanics of the process aren't important to this discussion, but somehow data gets from the user to your app server and gets passed on to be stored inside the database.

    Your application can get the connection information like the client IP address and OS Account, and the mechanics of that process may be different but the basic procedure is the same.

    Once you have all of the data on the application server that you need for a transaction, the application server can pass that data to the database. The mechanics of passing the connection data and the application data that are stored on the application server on to the database server are identical... You can (and probably should) pass the connection data at the same time as the application data.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  5. #5
    Join Date
    Apr 2014
    Posts
    3
    Thank you very much Pat! I will give it a try...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •