ginaLakeErie
ginaLakeErie

Reputation: 3

Insert Data into Oracle table with server side Javascript

Situation: We have an ArcGIS online viewer that displays local utility area. We would like add the ability to the viewer to allow internal reporter to enter work request. That work request information will be inserted into a regular oracle data table for report.

Question: Is possible to insert data from some server side JavaScript? If so could you please provide some code sample?(the database connection string etc)

I am new to ArcGIS and HTML5 any help is appreciated. Thank you!

Upvotes: 0

Views: 2692

Answers (1)

Erick Gallegos
Erick Gallegos

Reputation: 11

Sure,

I'd recommend node.js for your server side code. it's highly scalable and can easily connect to databases.

then use one of these plugin to connect to your database.

here's and example.

function findByType(type, callback) {
var connection = mysql.createConnection({
    host: 'host.address',
    user: 'user',
    password: 'pass',
    database: 'MyDatabase'
});
connection.connect();
var statement = "UPDATE SET something = 'this function' where otherthing = '" + type + "'";
connection.query(statement, function(err, results) {
    if (err) throw err;
    callback(results);
});
connection.end();
}

one easy way to communicate with your server side code is through GET, POST, etc. Have your server side code look up and send it back to your javascript.

Upvotes: 1

Related Questions