javascript - 尝试将我的智能电视应用连接到 Azure 数据库
问题描述
我正在开始一个项目,我正在开发一个 web-OS 应用程序,并且我正在尝试将我的应用程序连接到数据库,这是我找到的一些代码,但我不明白,有没有人有关于如何的指南或视频做这个?
我不明白将数据库名称和凭据放在哪里以及如何调用返回的对象?
例子
var request = webOS.service.request("luna://com.palm.db", {
method: "get",
parameters: {
"ids" : ["J8rKTaBClIo"]
},
onSuccess: function (inResponse) {
console.log( inResponse.results.length() + " object(s) is(are) retrieved");
console.log( "Result: " + JSON.stringify(inResponse) );
// To-Do something
},
onFailure: function (inError) {
console.log("Failed to get the obejct(s)");
console.log("[" + inError.errorCode + "]: " + inError.errorText);
// To-Do something
return;
}
});
返回值
{
"returnValue": true,
"results": [
{
"_rev": 21,
"sample": "sample1",
"test": "test1",
"_id": "J8rKTaBClIo",
"_kind": "com.yourdomain.test:1"
}
]
}
我想获取此信息并将其显示为标签。
解决方案
http://webostv.developer.lge.com/api/webos-service-api/db/ That looks like it connects to some sort of internal DB. There is a way to connect js to a SQL Server DB but that would require that the client has the activex object. How to connect to SQL Server database from JavaScript in the browser?
If I had to guess you would have to create API calls to connect to the azure DB. Which you should be able to use Azure Functions. Which for this would probably be perfect. Plus functions you only are charged for usage, so you are charged based on the number of calls made against the function. https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook
推荐阅读
- php - 修复 SSL 证书问题:无法在 PHP 中获取真实的本地颁发者证书
- c++ - 如何使用 setw 格式化我的 ostringstream 的输出?
- c# - C# 从 datagridview 列获取电子邮件地址并使用 Outlook 发送电子邮件
- javascript - 使用按钮动态创建的弹出框
- python-turtle - 我不知道如何让龟蟒中的背景颜色起作用
- java - Java:无需重复测试即可测试多个静态方法的方法?
- python - 在 csv python 中折叠类别
- python - 赋值不总是变量吗?
- sql - 将整数转换为日期为 MM/DD/YYYY,例如从 20200926 到 09/26/2020?
- phpstorm - PhpStorm:什么是 php-cs-fixer 文件以及如何忽略它们