jane juan
jane juan

Reputation: 3

Javascript - how to directly interact with db?

I have an excel sheet, a JS application and a db. excel sheet has data. I need to open the file and read data from the JS application and insert it into the db(say oracle db). How to?

I think we cannot open and close file in JS, pls correct me if i am wrong since it poses a security issue. If that is the case, say if we have updated the data in the grid, or table in the JS application. and we want to insert all the data in to the db, how do we do it?

Upvotes: 0

Views: 128

Answers (3)

Zeeshan Hassan Memon
Zeeshan Hassan Memon

Reputation: 8325

First- there is pretty good module to read/write excel files in javascript-client or javascript-server:

js-xlsx

Someone has used it and provided a blog on its usage here

Second- You have to involve one more tier (server) to get the work done as per security standards. Or another option is BaaS (Back-end-as-Service) like Parse, Firebase to serve your client as database, it lets you directly save your stuff without involving/writing server. Or other option is to use SaaS like Mongolab, it exposes api for client to directly save into db.

Happy Helping!

Upvotes: 1

totten
totten

Reputation: 2817

You need a Proxy Service for interacting to DB. There is no db-connectors for JS. The simplest way to achieve your goal is to choose one of the scripting languages which can run on your server. Such as PHP, Python, ASP.NET, ASP etc. I suggest PHP or Python.

Upvotes: 0

Digant C Kasundra
Digant C Kasundra

Reputation: 1816

You cannot do this safely. You need a webservice that the javascript app can call and that service would write to the database. So you should build a restful web api.

Upvotes: 0

Related Questions