package net.sevecek.select;

import java.sql.*;
import org.mariadb.jdbc.*;
import org.springframework.jdbc.core.*;

public class SpousteciTrida {

    public static void main(String[] args) throws Exception {
        MariaDbDataSource dataSource;
        dataSource = new MariaDbDataSource();
        dataSource.setUrl("jdbc:mysql://localhost/DailyPlanet");
        dataSource.setUser("student");
        dataSource.setPassword("password");

        JdbcTemplate pokladacDotazu;
        pokladacDotazu = new JdbcTemplate(dataSource);

        Integer pocetAutoru = pokladacDotazu.queryForObject(
                "select count(autor_id) from autor",
                Integer.class);
        System.out.println("Pocet autoru v DB je " + pocetAutoru);
    }

}
