# ij.dataSource

#### Function

The `ij.dataSource` property specifies the datasource to be used to access the database. When specifying a datasource, Derby does not use the DriverManager mechanism to establish connections.

#### Syntax

To establish a connection using `ij.dataSource`, you need to set the `ij.dataSource.databaseName` property. If you want to create the database, specify the `ij.dataSource.createDatabase` property as well.

    ij.dataSource=dataSourcename
    ij.dataSource.databaseName=databasename
    [ij.dataSource.createDatabase=create]

#### Example

In the following example, `ij` connects to a database named `sample` using an `EmbeddedDataSource`. The `sample` database is created if it does not already exist.

    #
    # If your application runs on JDK 1.6 or higher, then you should
    # specify the JDBC4 variant of this DataSource:
    # org.apache.derby.jdbc.EmbeddedDataSource40.
    #
    java -Dij.dataSource=org.apache.derby.jdbc.EmbeddedDataSource
    -Dij.dataSource.databaseName=sample -Dij.dataSource.createDatabase=create
      org.apache.derby.tools.ij
    ij version 10.2
    CONNECTION0*
    * = current connection
    ij>

For more information about DataSources, refer to the JDBC documentation and "Using Derby as a J2EE Resource Manager" in the Java DB Developer's Guide.
Parent topic: ij properties reference
Related reference
ij.connection.connectionName
ij.database
ij.driver
ij.maximumDisplayWidth
ij.outfile
ij.password
ij.protocol
ij.protocol.protocolName
ij.showErrorCode
ij.URLCheck
ij.user
derby.ui.codeset