Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Connector {
- public Connection polacz(){
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("Nie znaleziono Drivera ");
- e.printStackTrace();
- }
- System.out.println("MySQL JDBC Driver Registered!");
- Connection connection = null;
- try {
- connection = DriverManager
- .getConnection("jdbc:mysql://localhost:3306/test","admin", "");
- System.out.println("Connected to DB");
- } catch (SQLException e) {
- System.out.println("Connection Failed! Check output console");
- e.printStackTrace();
- }
- return connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement