As we know, when executing any request in netezza, we need to specify the database name in the connection URL, which we must make dynamic in accordance with the required database with which we must perform the operation, so in case of simple Java code, we can use case below. 1) and in the case of spring loading, we can use case 2) below.
Case 1) before executing any request in netezza, we can execute the statement as
SET CATALOG # database name #;
therefore, it will automatically switch to the database specified in the set command.
Case 2) We can switch the database in netezza with switching the database at runtime
Use the Apache base data source ( BasicDataSource ) instead of DriverManagerDataSource when creating the component for the data source
Run - jdbcTemplate.execute ("SET CATALOG #database name #") before executing any query.
source share