Database Query

Version 3.x

Develop

  1. Create a new project and name it database_query.
  2. Choose New -> Scripting Service.
  3. Choose Server-Side JavaScript Service from the list of available templates.
  4. Give it a meaningful name (e.g database_query.js).
  5. Replace the generated code in database_query.js with the following:
1
2
3
4
5
6
7
8
9
10
11
12
	var query = require('db/v3/query');
	var response = require('http/v3/response');
	
	var sql = "SELECT * FROM MY_TABLE WHERE MY_COLUMN = ?";
	var resultset = query.execute(sql, [1]);
	
	response.println(JSON.stringify(resultset));
	
	response.flush();
	response.close();
	
Edit