# Connecting db8

**URL:** <https://forum.webosose.org/t/connecting-db8/1508>\
**Category:** Univ Colllab - Christ Univ\
**Created:** [July 27, 2021, 7:49pm UTC](https://forum.webosose.org/t/connecting-db8/1508 "2021-07-27T19:49:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pritam-CU](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@Pritam-CU](https://forum.webosose.org/u/Pritam-CU)\
**Post date:** [July 27, 2021, 7:49pm UTC](https://forum.webosose.org/t/connecting-db8/1508/1 "2021-07-27T19:49:53Z")

</div>

How to connect db8 and front-end ?

---

<div class="post-metadata">

**Author:** ![revanthtallam](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@revanthtallam](https://forum.webosose.org/u/revanthtallam)\
**Post date:** [July 28, 2021, 9:16am UTC](https://forum.webosose.org/t/connecting-db8/1508/2 "2021-07-28T09:16:01Z")

</div>

@Pritam-CU : You can connect to db8 using LS2 services.  
Refer to : [com.webos.service.db | webOS Open Source Edition](https://www.webosose.org/docs/reference/ls2-api/com-webos-service-db/)

---

<div class="post-metadata">

**Author:** ![Muniraju\_A](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/muniraju_a/32/542_2.png) [@Muniraju\_A](https://forum.webosose.org/u/Muniraju_A)\
**Post date:** [July 28, 2021, 10:02am UTC](https://forum.webosose.org/t/connecting-db8/1508/3 "2021-07-28T10:02:22Z")

</div>

@Pritam-CU ,  
You can use build in enact library([https://enactjs.com/docs/modules/webos/LS2Request/](https://enactjs.com/docs/modules/webos/LS2Request/)) to connect db8 and shared sample web app in the web app development training session .  
or you can use plain JavaScript as below to connect LS2rquest

```auto
<script type="text/javascript">
    var bridge = new WebOSServiceBridge();
    var url = 'luna://com.webos.service.systemservice/clock/getTime';
    var params = '{}';

    function callback(msg){
        var arg = JSON.parse(msg);
        if (arg.returnValue) {
            webOSSystem.PmLogString(6, "GETTIME_SUCCESS", '{"APP_NAME": "example web app"}', "UTC : " + arg.utc);
        }
        else {
            webOSSystem.PmLogString(3, "GETTIME_FAILED", '{"APP_NAME": "example web app"}', "errorText : " + arg.errorText);
        }
    }

    bridge.url = url;
    bridge.onservicecallback = callback;
    bridge.call(url, params);
</script>

```

---

<div class="post-metadata">

**Author:** ![Pritam-CU](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@Pritam-CU](https://forum.webosose.org/u/Pritam-CU)\
**Post date:** [July 28, 2021, 3:12pm UTC](https://forum.webosose.org/t/connecting-db8/1508/4 "2021-07-28T15:12:07Z")

</div>

Thank you for the help.  
I know how to use queries in the console but it will be helpful if you give some more insights on how to implement the same in webapp(js).
