access CLOB data in a DB thru JAVASCRIPT

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thinnappan
    New Member
    • Sep 2013
    • 2

    access CLOB data in a DB thru JAVASCRIPT

    how to access the clob data that is present in a Database through javascript function.?
    The scenario is if i click a link then it should throw a pop up screen with the clob files that are present in the particular DB. i need to write it as a function.

    Thanks in Advance
    Thinnappan M
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    which DB are you using?

    Comment

    • thinnappan
      New Member
      • Sep 2013
      • 2

      #3
      thanks for ur reply,

      i need to create a standalone function. so imagine i just have a seperate oracle database in which clob datas are present. so if i click that link the clob files that are present in the DB should be displayed as a pop-up

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        simplified spoken, you need to write an API Adapter using AJAX.

        reason: your DB is on the server and hence your client-side JavaScript cannot establish a connection. You have to make JavaScript to connect to your server-side language (via XmlHttpRequest) and call a script (the script is your API*) there that executes the desired DB operation and returns the result to JavaScript.
        Code:
        +----------------+
        | browser        |
        | +------------+ |
        | | JavaScript | |
        | +------------+ |
        |        |  A    |
        +--------|--|----+
                 |  |
                 |  |
              (Internet)
                 |  |
                 |  |
        +--------|--|----+
        | server V  |    |
        | +------------+ |
        | | PHP script | |
        | +------------+ |
        |      |  A      |
        |      |  |      |
        |      V  |      |
        | +------------+ |
        | | Oracle     | |
        | +------------+ |
        +----------------+
        note, PHP is just an example for a server-side language

        * - of course you could also expose your server-side API also through SOAP or a RESTful WebService (but that still requires a server-side language, you don’t interact directly, though)
        Last edited by Dormilich; Sep 25 '13, 11:15 AM.

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          though ... you could also try to make a direct socket connection with the DB, although that requires 1) the DB to actually allow that and 2) you need to know the correct socket commands to make the DB correctly answer.

          if you ask me, the other way is far easier.

          Comment

          Working...