Tables
You can use the getTables() method of the DatabaseMetaData interface to retrieve a list of tables:
String connectionString = "jdbc:myob: If using an online instance: InitiateOAuth=GETANDREFRESH;OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CompanyFileId=yourCompanyFileId;CallbackURL=http://localhost:33333;User=companyFileUser;Password=companyFilePassword; If using an on premise instance: InitiateOAuth=OFF;URL=http://localhost:8080/accountright;CompanyFileId=327eed10-9615-4e5e-bd9e-ae2cc00e2c70;User=companyFileUser;Password=companyFilePassword;"; Connection conn = DriverManager.getConnection(connectionString); DatabaseMetaData table_meta = conn.getMetaData(); ResultSet rs=table_meta.getTables(null, null, "%", null); while(rs.next()){ System.out.println(rs.getString("TABLE_NAME")); }
The getTables() method returns the following columns:
Column Name | Data Type | Description |
TABLE_CAT | String | The table catalog. |
TABLE_SCHEM | String | The table schema. |
TABLE_NAME | String | The table name. |
TABLE_TYPE | String | The table type. |
REMARKS | String | The table description. |