<div class="meta" robots="noindex">

</div>

Method

# Database_Class.Connect

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use Database.Connect (above)\]\] as a replacement.

</div>

## Description

Connects to the database so that you can begin using it. Before proceeding with database operations, test to be sure that <span class="title-ref">Connect</span> returns `True</api/language/true>`.

## Notes

<div class="warning">

<div class="title">

Warning

</div>

A `DatabaseException</api/exceptions/databaseexception>` will be raised if the connection could not be made.

</div>

## Sample code

This example connects to the database object in the variable db:

``` xojo
Try  
  db.Connect
  MessageBox("Connected!")
Catch error As DatabaseException
  MessageBox("Error connecting to the database: " + error.Message)
End Try
```

## Compatibility

All project types on all supported operating systems.
