-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaglanti.java
More file actions
45 lines (39 loc) · 1.17 KB
/
baglanti.java
File metadata and controls
45 lines (39 loc) · 1.17 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package arduinoradar;
/*
* 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.
*/
/**
*
* @author mkuta
*/
import java.sql.Connection;
import java.sql.DriverManager;
/**
*
* @author ecir
*/
public class baglanti {
protected static final String SERVER="jdbc:mysql://localhost:3306/arduino";
protected static final String KULLANICIADI="root";
protected static final String SIFRE="1234";
protected Connection baglanti=null;
protected void baglan(){
try{
Class.forName("com.mysql.jdbc.Driver");//İlgili dosyanın belleğe yüklenmesini sağlar
baglanti=DriverManager.getConnection(SERVER,KULLANICIADI,SIFRE);//veri tabanına bağlanmayı sağlar
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
protected void baglantiKes(){
try{
baglanti.close();//açık olan bağlantıyı kapatır
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
}