Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication1;
- import java.sql.*;
- public class DatabaseClass {
- private String DBURL = "jdbc:mysql://localhost:3306/myjpm?user=root&password=";
- Connection con = null;
- Statement st = null;
- ResultSet rs = null;
- public DatabaseClass(){
- System.out.println("Making Connection to Database Server");
- try {
- con = DriverManager.getConnection(DBURL);
- } catch ( SQLException e ){
- e.printStackTrace();
- }
- }
- public void ExcuteSQL(String vSQL){
- try {
- st = con.createStatement();
- st.execute(vSQL);
- } catch ( SQLException e){
- e.printStackTrace();
- }
- }
- public ResultSet GetResults(String vSQL){
- try{
- st = con.createStatement();
- rs = st.executeQuery(vSQL);
- }catch(SQLException e){
- e.printStackTrace();
- }
- return rs;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement