The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/database > getDatabase

getDatabase() function

Returns the instance of the Realtime Database SDK that is associated with the provided FirebaseApp. Initializes a new instance with with default settings if no instance exists or if the existing instance uses a custom database URL.

Signature:

export declare function getDatabase(app?: FirebaseApp, url?: string): FirebaseDatabase;

Parameters

Parameter Type Description
app FirebaseApp The FirebaseApp instance that the returned Realtime Database instance is associated with.
url string The URL of the Realtime Database instance to connect to. If not provided, the SDK connects to the default instance of the Firebase App.

Returns:

FirebaseDatabase

The FirebaseDatabase instance of the provided app.