// This module is included in the following assembly:
// connecting/master.adoc

[id='how-to-specify-the-schema-in-a-database-connection_{context}']
= How to specify the schema in a database connection

In {prodname}, when you create a database connection, the user interface 
prompts you to specify the database’s schema. How you specify the 
schema varies for each database. The table below shows what each database 
requires. 

[options="header"]
[cols="1,2,2"]
|===
|Database
|Example connection configuration
|Notes

|Apache Derby
|*Connection URL* (JDBC URL): `jdbc:derby:memory:testdb;create=true` +
*Username*: `sa` +
*Password*: any value +
*Schema*: `sample`
|For testing purposes only. The default username is `sa` and the password can 
be anything but you must enter a value. 
In this example configuration, the connection uses the `sample` schema, which is like 
a namespace. For example, you can reference the `mytable` table with `sample.mytable`. 

|MS SQLServer 
|*Connection URL* (JDBC URL): `jdbc:sqlserver://localhost:1433/sampledb` +
*Username*: `kurt` +
*Password*: `mypw` +
*Schema*: `sampledb`
|Upload the driver by using the 
link:{LinkSyndesisIntegrationGuide}#creating-jdbc-driver-library-extensions_extensions[extension mechanism].
Then create a connection. Connection verification fails if you have 
not already uploaded the driver. You must specify the same schema at the end of 
the connection URL and in the *Schema* field. 

|MySQL
|*Connection URL* (JDBC URL): `sql-connector.url=jdbc:mysql://mysql-host:3307/test?allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC` + 
*Username*: `kurt` +
*Password*: `mypw` +
*Schema*: 
|MySQL does not support schemas. When you create a connection to 
a MySQL database,  leave the *Schema* field blank. MySQL expects all 
configuration in the connection (JDBC) URL. 

|Oracle DB
|*Connection URL* (JDBC URL): `jdbc:oracle:thin:@10.192.212.255:1521:xe` +
*Username*: `kurt` +
*Password*: `mypw` +
*Schema*: 
|Use the {prodname} 
link:{LinkSyndesisIntegrationGuide}#creating-jdbc-driver-library-extensions_extensions[extension mechanism].
to upload an Oracle database driver. 
Then create the connection. Connection verification fails if the driver has 
not been uploaded. +
The schema is the database name. You must have permission to access this 
database instance, which is referred to as a schema in Oracle terminology. 
Leave the *Schema* field blank. In the *Connection* field, 
you must reference the Oracle system identifier (SID) of this database
instance (`xe` in this example). 

|PostgreSQL
|*Connection URL* (JDBC URL): `jdbc:postgresql://syndesis-db:5432/sampledb` +
*Username*: `kurt` +
*Password*: `mypw` +
*Schema*: `sampledb`
|You must specify the database in the connection (JDBC) URL. T
If you want to use a schema you must specify it in the *Schema* field. 
A query can refer to a table in the form 
_database.schema.table_. When a reference specifies only 
a table name, the connection first searches the schema that you specify 
when you configure the connection. If the table is not found, 
then the connection searches public resources for the specified table. 
For more details, see 
link:https://www.postgresql.org/docs/9.1/ddl-schemas.html[PostgreSQL schema documentation].

|===


