Database.java

From Colorant Terrapin, 9 Months ago, written in Java, viewed 126 times.
URL https://paste.monocul.us/view/1293ca8f Embed
Download Paste or View Raw
  1. package com.centrisportivi;
  2.  
  3. import java.sql.*;
  4.  
  5. public class Database {
  6.  
  7.         static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";  
  8.         static final String DB_URL = "jdbc:mysql://localhost/EMP";
  9.         static final String DATABASE = "pippo";
  10.         static final String USERNAME = "nada";
  11.         static final String PASSWORD = "toor";
  12.        
  13.         static public Connection db_conn = null;
  14.        
  15.         public static void Initialize()
  16.         {
  17.                  try {
  18.                         Class.forName("com.mysql.jdbc.Driver");
  19.                         System.out.println("Connecting to database...");
  20.                          
  21.                         db_conn = DriverManager.getConnection(DB_URL,USERNAME,PASSWORD);
  22.                        
  23.                        
  24.                 } catch (ClassNotFoundException | SQLException e) {
  25.                         // TODO Auto-generated catch block
  26.                         e.printStackTrace();
  27.                 }
  28.                
  29.         }
  30. }
  31.  

Reply to "Database.java"

Here you can reply to the paste above