public class StudentDao {
private static Connection conn = null;
public void initConnection()
{
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
conn = DriverManager.getConnection("jdbc:sqlserver://127.0.0.1:1433;DataBaseName=test","sa","dev26");
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void closeConnection()
{
try
{
if(conn!=null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}