Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

public class DB {

public Connection conn = null;

public DB() {
try {
System.out.println("inside class.....");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//String url = "jdbc:mysql://localhost:3306/Crawler";
conn = DriverManager.getConnection("jdbc:odbc:data1");
System.out.println("conn built");
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}

public ResultSet runSql(String sql) throws SQLException {


Statement sta = conn.createStatement();
return sta.executeQuery(sql);
}
}

You might also like