Accessing .mdb or SQL databases using javascript in Firefox/Chrome - javascript

I have been tasked with creating something that summarizes and displays information from a database (that is stored either in an SQL server or as an .mdb). I cannot convince my company that we need to use an actual application for this, since I am apparently the only one that understands Visual Basic or C#. All of the other programmers know only HTML and Javascript, and since they're worried about making something that only one person can maintain (can't say I blame them, since I'm not looking forward to being the only person who can answer our customer's questions), these are the languages I'm limited to.
I've had a fair amount of success in creating ActiveX ADO objects for manipulating databases, but it's my understanding that this function won't work at all in browsers other than IE. Since I'm absolutely sure that this will be their next demand of me, is anyone aware of any way to read databases (stored locally on the computer displaying the page, in a shared folder on the network, or in an SQL database on that network) in non-IE browsers?
I've found various plugins to allow these sorts of things; this might work as a last resort, but I'm really trying to avoid having to tell the customers that our app will only work if they install some random plugin.
Any ideas?

To open .mdb databases in JavaScript, you can use: AccessDB, it's a library to work with Access databases in JavaScript:
http://accessdb.sourceforge.net/
To fire queries at a SQL-server in your network, you could probably use: HTML5Sql: http://html5sql.com/
I haven't used the latter before though.

I was looking for a similar type of thing a while ago and also found the AccessDB JavaScript file. From what I understand, it only works in Internet Explorer because of the way the ActiveX objects work, as you mentioned. I would love this to work in Chrome but I have not yet been able to get it to work in Chrome.
That said, I used the js file to produce some applications that pulls data from the database very well. I use Access to formulate the queries since the SQL is a little different. I've been able to do just about anything including crosstab queries and export the data to html tables with ease.

Related

JSON file simultaneous reads

I've been tinkering a bit on a small application which would show a limited amount of data to the viewer in a nicer way. I was thinking instead of opting for a database (be it SQLiteor / MongoDB) to have my data stored in a simple json file. It would have below characteristics:
Static data (will never have to be updated - 100-150 arrays)
Not private data - can be freely accessed by anybody which has access to the application
Offline application (not a single connection with internet)
Multiple users which would read only the data
JavaScript being used for this
What I am wondering about though is simultaneous reads. The application would never be used to update the data, it remains static. However there might be several people using the application simultaneously. As the tool will be stored on a shared drive, accessible by several other clients at the same time (only to read the file).
As I haven't touched anything with data or databases yet, I'd wanted to see if anybody already tried this out before I go into it deeper.
I am aware of the implications in terms of security however the data inside the application is not secure data and can be accessed by anybody freely. I only want to show it in a nice way. And as it is static anyway I was going to opt for a JSON file i/o starting to work with a database to speed up the development.
As far as I can see from your description, I think that there should be no conflict. You should be fine.
It's actually fairly common to use JSON-formatted files to store truly-static data.

Is it possible to retrieve data from parse.com using objective-c and show it in website?

I have an iOS app in which I use parse.com as backend service. Now, I hired someone to do a website interface using HTML and CSS. I want to share the same data between iOS app and website, I know parse.com offers me a few ways to do this, including creating a javaScriptapplication. The problem is, my programmer doesn't have any experience in JavaScript, nor do I.
My question is: Is it possible to use what I have (objective-c, xcode) as far as retrieving data from parse.com and showing on website? Even if I need to code something new, is it possible to use objective-c together with HTML and CSS?
Thanks.
Parse has several APIs, one of which is REST. Your web developer should use the REST API to get data from Parse
https://www.parse.com/docs/rest
If there is will there is way, but you'll be making something really specific to your use and will be non standard and will be immediately hard to maintain, I recommend that you hire another developer and do things properly using the technologies given to you by parse !. if the cost will be high now I can promise you it'll be much higher if you went the path you're going to now.
So my answer is:
Yes, everything is possible and no, don't do it ! :)
Edit: Added an example to a possible way to do it to actually answer OP's question.
Example case:
1-Create a simple Mac Application in Xcode that fetches data exactly like you do it on iOS, and store the needed data into a database of your choice on your server
2-You now have access to the data you needed from parse, but on a local mirror. you will need some tool to fetch that data though, I recommend a simple PHP script.
Note that this will require an OSX server to always be running to fetch that data, you'll also need of find a way to fetch data on demand when a user needs it Vs. polling at specified intervals, this will hardly scale and will be costly as I said.

saving data in HTML and javascript

I feel like this is a complicated topic, I searched everywhere and can't seem to find a good method to save data from users. I'm making an incremental and want people to be able to leave their browsers and have their data saved when they come back. Anyone have any suggestions?
It's pretty easy though I guess it might depend on your app. Easiest way is through using HTML5 localStorage which is built in permanent storage for modern browsers that can be manipulated easily with javascript. A good article here. If you are concerned about browsers that don't support localStorage then you can use one of the libraries that offers cookie fallback such as jStorage which happens to have a form example.
It sounds like you're going to need an SQL database. I'd recommend learning SQL, and learning a server-side programming language like PHP or ASP to automatically access the database. There is a lot to cover. I learned originally using w3schools, and have supplemented my education since then. w3schools an okay (not good, just okay) reference, but I wouldn't really recommend learning entirely from it. I'd recommend learning from youtube tutorials to get demonstrations and reading the manual for your server-side language.
You may want to look into HTML5 Web Storage. The localStorage object can be used to store data (strings) in the user's browser (not server-side). HTML5 Web Storage is widely supported in modern browsers.
If you need the data server-side as well, cookies may be a good choice for small amounts of data.
If you have large amounts of structured data and wide browser support is not crucial, you should check out HTML5 IndexedDB.

Jquery Table to Excel

I want to add Excel button below the html table, that gives an Excel sheet of the table. I am using C# behind it, but I want it do on client side just using jQuery or Javascript without using PHP or .NET... Not more.
I am searching for hours however I don't find any fix solution. There it said you can use activeX object and CSV however I don't see any running examples.
ActiveX will only run on Internet Explorer so your solution will be limited to that platform.
Without ActiveX or server side scripts there is no way to achieve this due to JavaScript security designs it is not allowed to create files or push in memory files to download streams.
I would not recommend ActiveX or anything that tries to run code outside of the browser on the client system. ActiveX only works on IE not to mention the inherent security risks that brings about.
A possible method would be to use a server side script along with jquery to generate the file and return it without ever leaving the page your on. It looks good and you don't really have to jump through hoops to make it work nor will the user. (if you want an example of the jquery required to do this let me know).
For c# there is alot of tutorials on generating excel files from your data for example here.
The only reason I can think of that you would want to create the file locally is use of resources on your server. C# will be extremly efficient in generating that file not to mention there are a couple things you can do (dependant on the data) to negate any impact it has:
If the data changes are few and far between consider storing the
generated file and directing to that the next time until the data has
been changed.
Limit the data set it returns by way of a search criteria
There are plenty more optimization you could do but you get the idea.

Adding nodes to XML with a form

I've created a list using XML and have embedded an XSL stylesheet in it. Now I want to know, because this is a list of movies that constantly grows, is there a way to create a form that will add child and grandchild nodes to the list.
I'm thinking there might be some javascript involved, but I have no idea what I'm doing when it comes to scripting.
If the intension is to write new entries into this xml file you need to look at some form of serverside scripting. Javascript can not write to files.
PHP is probably the easiest to understand, start by buying a book that explains the basics with a few examples, it's not that hard to grasp, and a form and a simple function for writing to files shouldn't take you to long to figure out.
If you have no interest in that sort of thing, hire someone to do the job for you, it will probably only take a few hours for someone who knows what they are doing to get a complete system up and running for you, and unless you really would like to learn a serverside language that is probably the best option.
If you really want to do it all on the client side, you can try HTML5 client-side storage. This means the data will be persistent only for the user that enters the data (and only for the browser used to enter it, and only on the computer that was used).
If you want the movies to be accessible to multiple people, or from multiple computers, you need to use server-side storage.
FYI, HTML5 storage is not yet very well standardized across browsers.

Categories

Resources