-
Notifications
You must be signed in to change notification settings - Fork 4
/
Conn.java
28 lines (21 loc) · 991 Bytes
/
Conn.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package travel_and_Tourism_Organisation_System;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.sql.*;
public class Conn{
Connection c;
Statement s;
public Conn(){
try{
Class.forName("com.mysql.cj.jdbc.Driver"); // register the drive class
c =DriverManager.getConnection("jdbc:mysql:///tms","root","tanu@1875"); // creating connection string
s =c.createStatement(); //creating the statement
}catch(Exception e){ //execute queries
// close connection
System.out.println(e);
}
}
}