---
title: Remote database access
description: "The WP Data Access API can be used to connect to local and remote databases. Here is a basic example which shows how to connect, perform a query and dump the query results on the screen. ```"
url: "https://docs.legacy.wpdataaccess.com/docs/remote-database-access/"
updated: "2025-11-19"
category: Legacy Tools / Code / API
---

# Remote database access

The WP Data Access API can be used to connect to local and remote databases. Here is a basic example which shows how to connect, perform a query and dump the query results on the screen.

```
<?php

// Connect to remote database
$wpdadb = WPDataAccessConnectionWPDADB::get_db_connection( 'rdb:sqlserver' );

// Perform query
$rows = $wpdadb->get_results( 'select * from movies' );

// Dump query result on screen
var_dump($rows);
```

This code works similar for local and remote databases. A database must be accessible from WP Data Access. Access can be verified from the Data Explorer.

## Notes

- The API works similar for SQL Server, MS Access, PostgreSQL and other supported RDBMS
