Advertisement
sergAccount

Untitled

Mar 14th, 2021
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package testdb;
  7.  
  8. import java.sql.*;
  9.        
  10. public class DataBaseUtil {
  11.    
  12.     // метод для получения соединения !!!
  13.     // Connection - интерфейс для получения соединения с БД
  14.     public static Connection getConn() throws SQLException{        
  15.         String connectionString = "jdbc:mariadb://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&user=root&password=";
  16.         final Connection connection = DriverManager.getConnection(connectionString);
  17.         return connection;
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement