Database schemas tell you which tables and views a connection can reach. In the Eclipse IDE on the Linux desktop, Data Source Explorer uses a Java Database Connectivity (JDBC) profile to open a database and browse its schemas.

Eclipse Data Tools keeps the driver definition and the connection profile in the workspace. The driver definition points to a database vendor's JAR file, while the profile holds the URL and login details for one database.

An embedded H2 database lives in a local file. The H2 URL option IFEXISTS=TRUE makes the connection fail if the database file is missing.

Steps to connect to a database in Eclipse using JDBC:

Start in the default workbench of Eclipse IDE for Enterprise Java and Web Developers with the Welcome tab closed, in a workspace without a Generic JDBC driver definition or profile. Your database's JDBC driver must report catalogs, as H2 does, so Data Source Explorer shows Catalogs above Schemas. Have the JDBC JAR in Downloads, the driver class, the database name, the JDBC URL, the database login details, and a schema name you expect to see. The worked values are for an existing H2 database at ~/Documents/inventory.mv.db with the password-protected user catalog_reader and an INVENTORY schema. For an embedded database, the file should be closed in other applications. For a shared database, use an account with only the access needed to browse its schemas.

If Eclipse opens a sponsor page in your browser, you can close it. If the Install Java 27 Support notice appears, you can install the support or choose Remind Me Later. Continue with step 1 when the workbench is ready.

  1. Open Data Source Explorer from Window > Show View > Data Source Explorer.
  2. Click Maximize at the upper right of the Data Source Explorer pane.
  3. Right-click Database Connections in Data Source Explorer.
  4. Select New… in the context menu.
  5. Select Generic JDBC under Connection Profile Types.
  6. Click Next > with the default profile name New Generic JDBC.
  7. Click New Driver Definition beside the Drivers list.
  8. Select the Generic JDBC Driver template under Database.
  9. Open the JAR List tab.
  10. Click Add JAR/Zip… to open the file chooser.
  11. Open Downloads in the file chooser.
  12. Double-click the JDBC driver JAR for your database.

    The file shown is h2-2.5.252.jar from the H2 Database Engine site.

  13. Open the Properties tab in New Driver Definition.
  14. Click the Value cell for Driver Class.
  15. Click the ellipsis button in the Driver Class value cell.
  16. Select Browse for class in Available Classes from Jar List.
  17. Select your driver's class, shown here as org.h2.Driver.
  18. Click OK.
  19. Click OK in New Driver Definition to save the driver.
  20. Double-click the default SAMPLE value in Database to select it.
  21. Enter your database name in Database, such as inventory.
  22. Place the cursor after jdbc: in the URL field.
  23. Append the part of your JDBC URL that follows jdbc:.
    h2:~/Documents/inventory;IFEXISTS=TRUE

    The H2 value uses the database file's path without its .mv.db extension.

  24. Click the User name field.
  25. Enter your database user name, such as catalog_reader.
  26. Click the Password field.
  27. Enter the password for that user in Password.

    With Save password clear, Eclipse saves the profile without the password.

  28. Click Test Connection to try the profile against the database.

    If the test fails, check the driver JAR, database URL, and login details and retry Test Connection before saving the profile.

  29. Dismiss the Success dialog with OK.

    The message reads Ping succeeded! when Eclipse can open a connection.

  30. Connect to the database with Finish.

    With Connect when the wizard completes selected, Finish saves the profile and opens the connection.

  31. Expand the New Generic JDBC profile in Database Connections once the status bar shows Connected.
  32. Expand your database node, shown here as inventory.
  33. Expand Catalogs under the database node.
  34. Expand the catalog for your database, shown here as INVENTORY.
  35. Expand Schemas under the catalog.
  36. Confirm that Schemas lists the schema you expect, such as INVENTORY.
Share this guide