- Browse the schemas, tables, and columns the connected database user can see
- Run SQL queries and show the results in your app
- Export larger query results as CSV, up to 100,000 rows
Common use cases and example apps
These examples show what you can build with IBM Db2, each with a prompt to start from.How to connect IBM Db2
Who can create IBM Db2 connections depends on your plan and workspace settings. App + chat connectors are available by default on Free, Pro, and Business plans. On Enterprise plans, they are effectively disabled at first: Who can create connections and clients defaults to No one until an admin changes it in Connectors → Admin settings → App + chat connectors. You can create multiple IBM Db2 connections using different instances or database users, which is useful for separating environments or limiting each app to the data its user can see. When the connection is created, you can link it to the projects where you want to use it. Anyone building in a project can ask Lovable in the project chat to link their project to it.Prerequisites
Before connecting IBM Db2, make sure you have:- A Db2 on Cloud instance in your IBM Cloud account
- A database userid and password for that instance (Step 1 shows where to find them)
- Permission to create connections in your Lovable workspace (see Who can create connections and clients)
Queries made through this connector run on your Db2 instance and use its compute. Billing is handled directly by IBM Cloud, not Lovable.
Step 1: Get your Db2 endpoint and credentials
The connector signs in with a database userid and password and needs your instance’s REST API endpoint. Queries run with that user’s database privileges. To collect the connection details:1
Open your instance in IBM Cloud
Sign in to IBM Cloud, open the Resource list, and select your Db2 instance.
2
Create a database credential
Open the instance’s Service credentials tab and click New credential. The credential JSON contains a
username and a password for the database. In Step 2, enter the username value in the Userid field.3
Copy the deployment CRN
The instance panel shows the Cloud Resource Name (CRN), a long identifier starting with
crn:v1:bluemix:. Copy it. The connection form asks for it.4
Note the REST API endpoint
The endpoint is regional:
https://<region>.db2.saas.ibm.com, where <region> is the region of your instance, for example us-south.Step 2: Connect IBM Db2 to Lovable
Open the connection form and enter the values from Step 1.1
Open IBM Db2 in Connectors
Open Connectors and select IBM Db2. For the other places to open the catalog from, see Where to find connectors.
2
Add a connection
Click Add connection and select App + chat connector. The form is split into collapsible sections, Details, Configure connection, and Sharing.
3
Name the connection
Under Details, Lovable fills in a name for the connection, which you can change. The name is only used inside Lovable to identify the connection.
4
Configure the connection
Under Configure connection, enter:
- REST API endpoint: the https endpoint from Step 1, for example
https://us-south.db2.saas.ibm.com. - Deployment CRN: the CRN from Step 1. The form marks this field optional, but Db2 on Cloud needs it.
- Userid: the database userid from Step 1.
- Password: the password issued alongside the userid.
5
Choose who can use this connection
Under Sharing, the connection is private to you by default and shows a Private label. To share it, click Share with others. Then add workspace members by email, or click Invite entire workspace to make the connection available to everyone in your Lovable workspace.See Who can use connections and clients for more information.
6
Connect
Click Connect. Lovable verifies the credentials against your Db2 instance before saving the connection.
Limitations
The IBM Db2 connector cannot:- Connect to a Db2 server you run yourself. The connector uses the IBM Db2 REST API, which serves managed Db2 instances in IBM Cloud.
- Page through query results. Each query returns up to a row limit that the app sets. For larger reads, the app can export results as CSV, up to 100,000 rows.
- Support per-end-user IBM Db2 login. Each connection represents a single database user shared across all projects linked to it.
Manage your IBM Db2 connection
Connections are managed from Connectors: select IBM Db2, then open the connection.- Unlink projects to remove IBM Db2 access from specific projects while keeping the connection available for others. See Unlink projects from a connection for the steps.
- Delete the connection to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use IBM Db2 stop working until a new connection is added. See Delete a connection for the steps and who can delete.