package com.example.Vezba;

import java.sql.*;

public class DB {
    Connection connection = null;
    Statement statement = null;
    String sql = null;

    public DB(){
        System.out.println("Connecting...");

        try{
            connection = DriverManager.getConnection("jdbc:mariadb://localhost/studije","root","");
            System.out.println("Connected.");
            statement = connection.createStatement();

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
/*
    public Student student(int index){
        sql = "SELECT * FROM student WHERE id="+index;

        try {
            ResultSet rs = statement.executeQuery(sql);

            if(!rs.first()){
                return null;
            }
            else{
                return new Student(index,rs.getString("firstName"),rs.getString("lastName"));
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }

        return null;
    }

 */

}
