Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2014
    Posts
    44

    Unanswered: Inserting values into ORACLE DB with JavaScript

    So I have this code,

    PHP Code:
     //prepare the fourth step
            
    var fields = new Array(
                $(
    '#revisiondate').val(),
                $(
    '#headmark').val(),
                $(
    '#quantity').val(),
                $(
    '#surface').val(),
                
    //+ ' ' + $('#lastname').val(),
                
    $('#blasting').val(),
                $(
    '#primer').val(),
                $(
    '#intermediate').val(),
                $(
    '#finishing').val(),
                $(
    '#subcontid').val()                     
            );
            var 
    tr = $('#fourth_step tr');
            
    tr.each(function(){
                
    //alert( fields[$(this).index()] )
                
    $(this).children('td:nth-child(2)').html(fields[$(this).index()]);
            });
                    
            
    //slide steps
            
    $('#third_step').slideUp();
            $(
    '#fourth_step').slideDown();            
        });


        $(
    '#submit_fourth').click(function(){
            
    // INSERTION INTO ORACLE DB
            
    alert('Data has been sent to the server');
        }); 
    this is the portion of my JS code to insert into the ORACLE database, I know how to do it in PHP but i dont know how to do it in JavaScript,
    Can you guys help me inserting the values of revisiondate, headmark, etc...

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    PHP runs on the server, but JavaScript runs on the client inside the browser.

    I doubt that your Oracle database is accessible from the client's computer and therefore you cannot access the database from JavaScript inside the browser.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  3. #3
    Join Date
    Mar 2014
    Posts
    44
    Quote Originally Posted by shammat View Post
    PHP runs on the server, but JavaScript runs on the client inside the browser.

    I doubt that your Oracle database is accessible from the client's computer and therefore you cannot access the database from JavaScript inside the browser.
    So do you have any idea how to bridge them ?
    thanks

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if uisng AJAX the you could send the results of the Javascript to the DB engine, or better yet send them to another script as you cannot ever trust the values being sent from a remote user DIRECT into a DB, irrespective of who that users is. ALWAYS, ALWAYS validate user input. you may argue you've already validated it in the Javascript, whichmay well be true, however there is nowt stopping users malicously (or even innocently) modifiying your javascript or worse malicous users sending malicous stuff to your db faking an innocnet script.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    EndUser<=>browser<=>WebServer<=>ApplicationServer< =>DatabaseServer

    >this is the portion of my JS code to insert into the ORACLE database,
    Do you really desire any random individual connected to the Internet to be able to issue DML against your database?

    Be careful what you ask for, since this would place whole DB security & integrity at risk.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  6. #6
    Join Date
    Mar 2014
    Posts
    44
    Quote Originally Posted by anacedent View Post
    EndUser<=>browser<=>WebServer<=>ApplicationServer< =>DatabaseServer

    >this is the portion of my JS code to insert into the ORACLE database,
    Do you really desire any random individual connected to the Internet to be able to issue DML against your database?

    Be careful what you ask for, since this would place whole DB security & integrity at risk.
    THank you for your suggestion, what do you think is the best solution for my case ??

  7. #7
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    > I know how to do it in PHP
    please do it the way you know.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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