# How to call remote db?

**URL:** <https://community.dreamfactory.com/t/how-to-call-remote-db/1036>\
**Category:** REST API\
**Created:** [April 24, 2015, 2:16pm UTC](https://community.dreamfactory.com/t/how-to-call-remote-db/1036 "2015-04-24T14:16:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![glemiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/glemiere/32/271_2.png) [@glemiere](https://community.dreamfactory.com/u/glemiere)\
**Post date:** [April 24, 2015, 2:16pm UTC](https://community.dreamfactory.com/t/how-to-call-remote-db/1036/1 "2015-04-24T14:16:25Z")

</div>

Hi !  
I created a service names “sql”. My problem is that I don’t understand two things.  
First : How to connect my new API ?

```
var dsp_url = "http://localhost/rest/sql";
var app_name = "api";

```

When I’m trying to loggin, my console tell me : Uncaught TypeError: window.app.login is not a function. I can only loggin with :

```
var dsp_url = "http://localhost/rest/api_docs";

```

The second thing is easier : have you got an example of ajax call using jquery to use this API ?

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [August 6, 2015, 7:40pm UTC](https://community.dreamfactory.com/t/how-to-call-remote-db/1036/2 "2015-08-06T19:40:53Z")

</div>

Your `dsp_url` should always be `http://localhost/rest/api_docs`, then all functions including window.app.login will be available. [The JS SDK readme](https://github.com/dreamfactorysoftware/javascript-sdk#javascript-sdk) makes this clear.

If you load the index.html from the [JS SDK](https://github.com/dreamfactorysoftware/dsp-core/wiki/Javascript-SDK), you will see described on the page how to access DB records. E.g.,

```auto
window.df.apis.db.getRecords({table_name: "todo"}, function (response) {
            console.log(response);
        });

```

Other available db functions will be displayed if you type window.df.apis in your browser debug console.

[Here is an example app in jQuery](https://github.com/dreamfactorysoftware/app-todo-jquery), and [here is a tutorial on how to use it](https://blog.dreamfactory.com/blog/bid/309897/jQuery-App-Tutorial-with-the-DreamFactory-REST-API). Also, the DreamFactory REST tester is written in jQuery and may be accessed at `http://{YourDreamFactoryURL}/test_rest.html`. Finally, [here is an Ajax app example](https://blog.dreamfactory.com/blog/bid/326051/Adding-a-Remote-Web-Service-to-Your-DSP) for implementing a remote web service call.
