首页 > 解决方案 > 尝试将我的智能电视应用连接到 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"
    }
]
}

我想获取此信息并将其显示为标签。

标签: javascripthtmlsqldatabasewebos

解决方案


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


推荐阅读