> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# dbListTables

> Lists the tables in the target database server.

export const siteNameShort = "Arc";

Lists the tables in the target database server. Depending on your configuration and the target database type, some of these parameters and output attributes might be irrelevant.

## Required Parameters

* **driver**: The JDBC driver class name in the cross-platform edition or the ADO.NET provider name in the .NET edition.
* **conn**: The connection string or database URL.

## Optional Parameters

* **includesystemtables**: Whether to include system tables. The allowed values are `true` or `false`. The default  is `false`.
* **schema**: The name of the database schema from which to list the tables. The schema is commonly referred to as the *namespace* of a group of tables.
* **catalog**: The catalog in the database server. This is commonly referred to as the *database*. If you do not provide a value, tables from all catalogs in the database server are returned.

## Output Attributes

* **db:name**: The name of the table.
* **db:type**: The type of the table.
* **db:schema**: The schema to which the table belongs.
* **db:catalog**: The catalog to which the table belongs. This is commonly referred to as the *database*.

## Example

In this example, the targeted database server is MySQL and the targeted catalog (database) is `sakila`. Notice that there is no `database` parameter in the connection string: if the database is specified in the connection string, the `catalog` parameter is not required. This script writes all the attributes of the target catalog (database) to an output file.

```xml theme={null}
<!-- Initializing the output item -->
<arc:set attr="output.data" />
<!-- Creating the input db item and the necessary attributes -->
<arc:set attr="db.driver" value="cdata.jdbc.mysql.MySQLDriver" />
<arc:set attr="db.catalog" value="sakila" />
<arc:set attr="db.conn" value="jdbc:cdata:mysql:server=localhost;port=3306;user=root;password=Password123;"/>

<arc:call op="dbListTables" in="db" out="results" >
  <!-- adding result data from the operation to an output item that will be pushed out as a file -->
  <arc:set attr="output.data">[output.data]\nTable Name=[results.db:name]\nType=[results.db:type]\nCatalog=[results.db:catalog]
  </arc:set>
</arc:call>

<!-- setting the filename and pushing the file out --> 
<arc:set attr="output.filename" value="results.txt" />
<arc:push item="output" />
```

The output file has the following format:

```
Table Name=address
Type=TABLE
Catalog=sakila
-----
Table Name=category
Type=TABLE
Catalog=sakila
-----
Table Name=city
Type=TABLE
Catalog=sakila
-----
Table Name=country
Type=TABLE
Catalog=sakila
-----
```

You can modify the example above to target other databases as long as the driver is installed on the machine where {siteNameShort} is installed and running. Adjusting this example for .NET involves changing the `driver` and `conn` inputs as follows:

```xml theme={null}
<arc:set attr="db.driver" value="System.Data.CData.MySql" /> 
<arc:set attr="db.conn" value="Server=localhost;Database=sakila;UID=root;Password=Password123;"/>
```
