Skip to content

Instantly share code, notes, and snippets.

@seppenen
Last active February 18, 2018 22:13
Show Gist options
  • Save seppenen/d4316fdd2fbaa30bf2e84b62fc427c92 to your computer and use it in GitHub Desktop.
Save seppenen/d4316fdd2fbaa30bf2e84b62fc427c92 to your computer and use it in GitHub Desktop.
DAO
public class Dao {
public Connection con=null;
public ResultSet rs = null;
public PreparedStatement stmtPrep=null;
public String sql;
public Connection yhdista() throws Exception{
Connection con = null;
String JDBCAjuri = "org.mariadb.jdbc.Driver";
String url = "jdbc:mariadb://localhost:15001/a1700185";
Class.forName(JDBCAjuri);
con = DriverManager.getConnection(url,"a1700185", "pass");
return con;
}
public void sulje() throws Exception{
if(con!=null){
con.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment