By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

access CLOB data in a DB thru JAVASCRIPT

P: 2
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
Sep 25 '13 #1
Share this Question
Share on Google+
4 Replies


Dormilich
Expert Mod 5K+
P: 8,639
which DB are you using?
Sep 25 '13 #2

P: 2
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
Sep 25 '13 #3

Dormilich
Expert Mod 5K+
P: 8,639
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.
Expand|Select|Wrap|Line Numbers
  1. +----------------+
  2. | browser        |
  3. | +------------+ |
  4. | | JavaScript | |
  5. | +------------+ |
  6. |        |  A    |
  7. +--------|--|----+
  8.          |  |
  9.          |  |
  10.       (Internet)
  11.          |  |
  12.          |  |
  13. +--------|--|----+
  14. | server V  |    |
  15. | +------------+ |
  16. | | PHP script | |
  17. | +------------+ |
  18. |      |  A      |
  19. |      |  |      |
  20. |      V  |      |
  21. | +------------+ |
  22. | | Oracle     | |
  23. | +------------+ |
  24. +----------------+
  25.  
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)
Sep 25 '13 #4

Dormilich
Expert Mod 5K+
P: 8,639
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.
Sep 25 '13 #5

Post your reply

Sign in to post your reply or Sign up for a free account.