SitePoint Sponsor

User Tag List

Results 1 to 15 of 15

Hybrid View

  1. #1
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript and database

    Hi,

    Javascript is client-side script and cannot be used to 'touch' the client side harddisk, for security reason.

    My question:
    1) Do you think that Javascript can be used to retrieve data from a database, like Access? If yes, how? Any reference?

    2) Can we use Javascript to insert/delete/update data into/from a database (Access, for example)?

    3) For PHP, we can download help file in .chm format, BUT for Javascript, wehere can I have its help file?

    Thanks in advance.

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes it is possible there are a few methods one is remote scripting.

    http://www.ashleyit.com/rs/jsrs/select/php/select.php
    http://msdn.microsoft.com/library/de...s/mediabar.asp

    another is using the xml dom

    http://andrew-j.port5.com/requests/requesting.html

    or databinding

    http://msdn.microsoft.com/library/de...ta_binding.asp

    now just make your asp/asp.net/php/perl serverside page and connect to it. Just echo the results and you can display it how you want. So you can update modify or what ever you want as you would normally do it with php etc

    manuals

    http://www.w3schools.com (website)
    http://download.com.com/3150-2059-0.html?tag=dir

  3. #3
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Andrew. All your methods, besides data binding, require server side scripting (remote scripting).

    BUT, what I am interested is pure client side scripting to manipulate data.

    For example, I write a ebook, and compiled ebook into exe format to protect my work, then I want to use Javascript to retrieve, insert, delete, update my database written in access, which is not compiled into the exe format. Since, I do not expect all my customers has / can install the server script, like php or asp (IIS, etc), SO I want the pure client side scripting, Javascript, to handle these data manipulations.

    Thanks in advance.

  4. #4
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok:
    1) as per usual - you can use Active X objects to create WSH and coms to handle all of this

    2) what the hell are you on about? The client doesn't have to install the language that the server uses - or have to have anything to do with it, the server language simply renders an html page to be interpretted normally.

    Your clients won't want to store the database on their machines - it doesn't allow for the notion that they might want to swap machines ... your better shot is to use your own database, on your server - and have them use username / password to access it in whatever method you're talking about.

    If you want more info - explain better what you're on about.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  5. #5
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Flawless_koder,

    I think that you are not understand what I want. Here it is:

    Let say I wrote an ebook. My content of my ebook are store in Access database which is distributed separately from my compiled ebook (exe format).

    So, when the user read chapter 1, the script will retrieve the chapter 1 contents from the Access database! They even can edit certain stuffs and store them in the said Access database, and subsequently send them bak to me using my asp/php script located at my server for example.

    So, they can edit and store the background color of the ebook in the Access database. They can customise what they want with my ebook.

  6. #6
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well let them do that on your database... let them change what they want about it ... and then send the info back to your database for storage via a php script?

    I have no idea what you're trying to achieve by this... and you seem to have a misunderstanding of what people are willing to do - installing access is often NOT part of what they are willing to do!

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  7. #7
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So what you want is that you they have a .mdb file that you will allow the user to modify in which the data will be sent to your mySQL (what ever) database. Just curious if im on the right lines, but why would you do it like this? maybe you can explain a little better
    Last edited by Andrew-J2000; Jun 10, 2002 at 02:43.

  8. #8
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright. I give you an example as follows:

    1) My ebook name: learnasp.exe
    2) My database (Access): learnasp.mdb
    3) I zipped them into a zipped file called: learnasp.zip

    4) user downlaod learnasp.zip
    5) user extract the zipped in c:\myebook
    6) in the c:\myebook has 2 files, learnasp.exe and learnasp.mdb

    7) user run learnasp.exe (read my ebook)
    8) my content of ebook is stored in learnasp.mdb

    9) so, the learnasp.exe has certain javascript that retrieve the chapter 1 content from learnasp.mdb
    10) user continue read chapter 2, 3, 4 etc

    11) user feel my ebook's colour boring.
    12) user change the ebook color, and the color setting saved in the learnasp.mdb (table ebooksetting, for example)

    13) when user run the ebook again (learnasp.exe) the color change by retrieve the color setting from the table ebooksetting (learnasp.mdb)

    14) user have comment, they can write the comment and save them in the learnasp.mdb (comment table, for example)

    15) when user online, user can send the comment to me. (A javascript retireve the comment and cal my server script at my server, and comment sending begin!)

    Do you get what I am trying to ask?

  9. #9
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Andrew - do you think this is a perfect example of when NOT to use javascript - i do.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  10. #10
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I actually can do this with ease in asp and compile the asp into exe together with the Access database using Octo Site Compiler. BUT, the Octo Site Compiler is too expensive.

    As a result of that, I wonder I can use another method, like Javascript (and NOT ASP) to do the same thing.

  11. #11
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes I agree, this is definately not for javascript.

    what i dont understand is what a database is needed in any circumstances for the clientside. Now what I would do is have visual basic run the ebook inside its own window. Have a configuration file called

    learnasp.ini

    use the ini file to update the configuration, remember to check whether the user updates to valid colors incase they change the file by in notepad. Other than that have options to do this in the program. I would have it so you have an invisible background with not window features and create your own custom handles ie close, minimise, maximise etc.

    The only way i can think of connecting to the database as soon as they come online properly is to test on random intervals, however i could find out the best method tonight if you really want to do it this way.

  12. #12
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is actually posible although i would recommend against it as you would have to have the user accept an active x each time you check a file, for the configuration settings

  13. #13
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or get the Active X signed as safe.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  14. #14
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would you do that Flawless?

  15. #15
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---


Bookmarks

Posting Permissions

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