Prerequisites: Install Mysql DB. Opem My SQL command line client and login as root user.
-- Create database for application
CREATE DATABASE app_dev;
| /** | |
| * Serialize the response into the DTO POJO. | |
| * Assumption: Jackson Jar is in classpath | |
| * @param strResponse | |
| * @return | |
| */ | |
| protected EmployeeDto convertResponseJsonToPojo(String strResponse) { | |
| ObjectMapper mapper = new ObjectMapper(); | |
| // Don't fail on unknown properties | |
| mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| import io.jsonwebtoken.Jwt; | |
| import io.jsonwebtoken.Jwts; | |
| import io.jsonwebtoken.SignatureAlgorithm; | |
| import io.jsonwebtoken.SignatureException; | |
| import io.jsonwebtoken.impl.crypto.MacProvider; | |
| import java.security.Key; | |
| import java.time.Instant; | |
| import java.time.LocalDate; | |
| Class ... { |
| //Reference: http://ostermiller.org/utils/Base64.html | |
| URL url = new URL("http://...."); | |
| HttpURLConnection connection = (HttpURLConnection)url.openConnection(); | |
| connection.setRequestProperty( | |
| "Authorization", | |
| "Basic " + Base64.encode( | |
| username + ":" + password | |
| ) | |
| ); | |
| InputStream in = connection.getInputStream(); |
| public class NetezzaTest { | |
| // Replace this with your logger implementation, if not using slf4j | |
| private static final Logger LOGGER = LoggerFactory.getLogger(NetezzaTest.class); | |
| public static void main(String[] args) { | |
| try { | |
| // Assumption is that Netezza driver is on classpath | |
| LOGGER.info("Connecting to netezza database."); | |
| Class.forName("org.netezza.Driver"); |
| @Resource | |
| private Environment env; | |
| public String getUserName() { | |
| return env.getRequiredProperty("APP.USERNAME"); | |
| } | |
| public String getPassword() { | |
| return env.getRequiredProperty("APP.PASSWORD"); | |
| } |
| import com.zaxxer.hikari.HikariConfig; | |
| import com.zaxxer.hikari.HikariDataSource; | |
| import org.hibernate.ejb.HibernatePersistence; | |
| import org.springframework.context.annotation.*; | |
| import org.springframework.core.env.Environment; | |
| import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | |
| import org.springframework.orm.jpa.JpaTransactionManager; | |
| import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; | |
| import org.springframework.transaction.annotation.EnableTransactionManagement; |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |