Before you can use the Teradata® AppCenter Java SDK, you must initiate the AppCenter client.
-
Use one of the following methods to initialize the AppCenter client:
Method Code Example Considerations try-with-resources try (AppcenterClient client = new DefaultAppcenterClient()) { // your codes that utilize the client}
Teradata recommends the try-with-resources method to make sure that each resource is closed at the end of the statement. try-catch-finally AppcenterClient client = null; try { client = new DefaultAppcenterClient(); // your codes that utilize the client } catch (...) { }finally { client.close(); }
Make sure you call client.close() in the finally block to ensure resources are closed properly. Initialize AppCenter client with AppContext AppcenterContext = new AppContext() .appcenterBaseUrl("https://appcenter.example.com") .system("aster-system") .build() try (AppcenterClient client = new DefaultAppCenterClient(appContext)) { // your codes that utilize the client }