Skip to content

Instantly share code, notes, and snippets.

View saifazmi's full-sized avatar
🏠
Working from home

Saif Azmi saifazmi

🏠
Working from home
View GitHub Profile
@saifazmi
saifazmi / PostgresConnection.java
Created November 11, 2015 12:12
connection for databse
package database.connect;
import database.properties.DBProperty;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
@saifazmi
saifazmi / DBProperty.java
Created November 11, 2015 12:11
creates a properties file for later use
package database.properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
@saifazmi
saifazmi / TestDBConnection.java
Last active March 31, 2016 15:47
Java code to check if you have the PostgreSQL jdbc driver configured properly and if you can access your database. Replace the string values for the database property where necessary.
package tests;
import database.properties.DBProperty;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;