By default, the platform includes a default datasource based on the Apache Derby database.
To access it, perform a JNDI lookup using its defined JNDI name (jdbc/DerbyDS
InitialContext context = new InitialContext();
DataSource source = (DataSource) context.lookup("jdbc/DerbyDS");
Connection connection = source.getConnection();
By definition, the default managed datasource has no schema definitions associated with it, so no scripts or tasks are performed on the first access of the database. Therefore, you cannot count on tables having been created or data being populated into those tables. You may use the default managed datasource and write JDBC code to perform your own database updates. You can also define a virtual datasource with schemaReferences
to perform the database updates on first database access, and then lookup the virtual datasource name, rather than the default datasource name. Refer to ../com.ibm.rcp.tools.doc.admin/dblifecyclemgtintro.html for more information on setting up managed datasource definitions.
Parent topic: Database Lifecycle Management: XPD622