Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
- * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
- */
- package sk.stu.fiit;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- //import java.sql.*;
- /**
- *
- * @author Administrator
- */
- public class DB_Tester {
- private final String url = "jdbc:postgresql://localhost/testovacia";
- private final String pouzivatel = "postgres";
- private final String heslo = "20626mir.";
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- DB_Tester dbtest = new DB_Tester();
- dbtest.connect();
- }
- private void connect() {
- Connection conn = null;
- try {
- conn = DriverManager.getConnection(url, pouzivatel, heslo);
- System.out.println("Gratulujem si sa pripojil...");
- conn.close();
- } catch (SQLException exSQL) {
- System.out.println("Nepripojil som sa - " + exSQL.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment