-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.js
68 lines (61 loc) · 1.4 KB
/
sample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var oracledb = require('oracledb');
var http= require('http');
function onRequest(request,response){
response.writeHead(200,{'Content-Type':'text/plain'});
console.write("Hello World!!");
response.end();
}
http.createServer(onRequest).listen(9000);
oracledb.getConnection(
{
user : "system",
password : "woRkhard@2596",
connectString : "localhost/XE"
},
function(err, connection)
{
if (err) {
console.error(err);
return; }
connection.execute(
"SELECT * "
+ "FROM stock_details",
function(err, result)
{
if (err) {
console.error(err);
return;
}
response.render('index.html', {
title: Welcome to Java Palace
,products: result
});
});
});
function increaseCount(src){
oracledb.getConnection(
{
user : "system",
password : "woRkhard@2596",
connectString : "localhost/XE"
},
function(err, connection)
{
if (err) {
console.error(err);
return; }
connection.execute(
"update stock_details set "
+ "Like_count=(select Like_count from stock_details)+1",
function(err, result)
{
if (err) {
console.error(err);
return;
}
response.render('index.html', {
document.getElementById("Like")=result
});
});
});
}