.

Sunday, January 9, 2011

payroll using java project source code part 10

for source code part 1 class MainMenu click here
for source code part 2 class LoginFrame click here
for source code part 3 class Emprptwindow click here
for source code part 4 class Editwindow click here
for source code part 5 class Deletewindow click here
for source code part 6 class clsSettings click here
for source code part 7 class Settingswindowclick here
for source code part 8 class printwindow here
for source code part 9 class Addwindow here


module name class clsConnection below

/* this code is intended education purpuse only. all rights reserved .copy right
protected .www.freejavaprojectsonline.blogspot.com . mails to : johnjustin@in.com */


import java.io.IOException;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JDialog;
import java.io.*;
import java.util.*;
import java.net.*;


public class clsConnection {
String url = "";
String username = "";
String password = "";


public Connection setConnection(Connection conn, String username, String password )

{
try
{

Properties props = new Properties();
String fileName = "MakeDB.ini";
FileInputStream in = new FileInputStream(fileName);
props.load(in);
String drivers = props.getProperty("jdbc.drivers");
if(drivers != null)
System.setProperty("jdbc.drivers", drivers);
url = props.getProperty("jdbc.url");
username = props.getProperty("jdbc.username");
password = props.getProperty("jdbc.password");
conn = DriverManager.getConnection(url,username,password);

}catch(SQLException e)
{
System.err.println("SQl Exception");
e.printStackTrace();

}

catch(IOException e)
{
System.out.println("\nIO Exception");
}
catch (Exception e)
{
System.out.println("\nAnother Error");
}
return conn;

}




}



NEXT => CLICK HERE TO DOWNLOAD DATABASE AND IMAGES OF PAYROLL USING JAVA ACADEMIC PROJECT ,complete source code of project

Google Ads