===== Database Connections ===== This section documents how database connections are configured and used in the MIStudio Logic Editor. Database connections allow MIStudio applications to read data from external databases, write or modify database data, and use query results as part of application logic. ==== Overview ==== Database workflows are built in the [[mistudio:logic_editor:start|MIStudio Logic Editor]] using database connection and database operation components. A typical database workflow includes: * Configuring access to an external database * Adding the required database or JDBC driver * Creating a database connection manager * Reading data with a query * Writing or modifying data when required * Connecting database results to other logic components * Testing the connection and query behavior The exact configuration depends on the database platform and authentication method being used. ==== Typical Database Workflow ==== A basic database workflow generally follows these steps: * Configure the database platform and connection information. * Make sure the required database driver is available to MIStudio. * Restart MIStudio if a new JDBC driver has been added. * Add the appropriate database connection manager in the Logic Editor. * Configure the host, port, database or schema information, authentication, and connection properties. * Add a database read or write component. * Connect the database component to the configured connection manager. * Enter the SQL statement. * Run the application logic and confirm the expected result. ==== Reading Database Data ==== Database read components are used for SQL statements that return data. Common examples include: * `SELECT` * Metadata queries * Table or schema checks * Queries used to populate graphics or other logic components Query results can be passed to other components in the Logic Editor. ==== Writing Database Data ==== Database write components are used when the SQL statement changes database content or structure. Common examples include: * `CREATE TABLE` * `INSERT` * `UPDATE` * `DELETE` Use the appropriate database write component rather than a lookup component when the SQL statement performs a write operation. ==== JDBC Drivers ==== Some database platforms require an external JDBC driver. The required driver depends on the database platform being used. When a JDBC driver is added to an MIStudio installation, MIStudio may need to be restarted before the driver becomes available to database connection components. Database-specific pages should document the required driver, driver class, installation location, and connection settings. ==== Connection Information ==== Database connection configuration may include: * Host name * Port * Database or catalog * Schema * User name * Password or access token * JDBC connection properties * Driver class * Platform-specific connection settings The required fields vary by database platform. ==== Testing Database Logic ==== When testing database components, confirm that MIStudio is running the application logic in **Simulating** mode. If a database query appears configured correctly but does not execute, confirm that simulation is active before changing the database configuration. A simple query such as: SELECT 1 can be useful for verifying that the connection is working before testing more complex SQL. ==== Troubleshooting ==== Common areas to check when a database connection does not work include: * The required JDBC driver is installed. * The driver was added to the MIStudio installation currently being used. * MIStudio was restarted after installing the driver. * The database host and port are correct. * Authentication information is correct. * Required connection properties are configured. * The correct database, catalog, or schema is being used. * The appropriate read or write database component is being used. * MIStudio is in **Simulating** mode when testing the database logic. Database-specific troubleshooting is documented on the individual connection pages. ==== Security ==== Database credentials should be handled securely. Avoid placing passwords, access tokens, or other credentials in documentation, screenshots, source control, or other locations where they may be exposed. Authentication methods and security requirements may differ between development, testing, and production environments. ==== Database Platforms ==== Database-specific pages provide connection and testing instructions for supported platforms. ^ Platform ^ Documentation ^ | Databricks | [[mistudio:logic_editor:database:connections:databricks|Connecting MIStudio to Databricks]] | Additional database platforms can be added to this section as their MIStudio connection procedures are documented and validated. ==== Related Pages ==== * [[mistudio:logic_editor:start|MIStudio Logic Editor]] * [[mistudio:getting_started:data_sources_overview|Data Sources Overview]] * [[mistudio:getting_started:connect_data_source_to_graphic|Connecting a Data Source to a Graphic]] * [[mistudio:servers:start|Servers and Data Sources]] * [[mistudio:logic_editor:database:connections:databricks|Connecting MIStudio to Databricks]]