Biblioteca Java - Diff between revs 3 and 35
Subversion Repositories:
Rev 3 | Rev 35 | |||
---|---|---|---|---|
Line 6... | Line 6... | |||
6 | import java.sql.Connection; | 6 | import java.sql.Connection; | |
7 | import java.sql.DriverManager; | 7 | import java.sql.DriverManager; | |
8 | import lab.scd.db.util.*; | 8 | import lab.scd.db.util.*; | |
9 | //import com.mysql.jdbc.*; | 9 | //import com.mysql.jdbc.*; | |
10 | /** | 10 | /** | |
11 | * Class created by @author Mihai HULEA at Mar 10, 2005. | - | ||
12 | * | 11 | * | |
13 | * This class is part of the laborator4_db project. | 12 | * This class is part of the laborator4_db project. | |
14 | * | 13 | * | |
15 | * Exemplifica pasii care trebuiesc realizati pentru a realiza o conexiune la o baza de date. | 14 | * Exemplifica pasii care trebuiesc realizati pentru a realiza o conexiune la o baza de date. | |
16 | * | 15 | * | |
Line 21... | Line 20... | |||
21 | public class TestConectare { | 20 | public class TestConectare { | |
22 | 21 | |||
23 | public static void main(String[] args) { | 22 | public static void main(String[] args) { | |
24 | try { | 23 | try { | |
25 | //incarcare driver petru baza de date | 24 | //incarcare driver petru baza de date | |
26 | Class.forName("com.mysql.jdbc.Driver"); | - | ||
- | 25 | Class.forName("org.apache.derby.jdbc.ClientDriver"); | ||
27 | 26 | |||
28 | //conectare la baza de date | 27 | //conectare la baza de date | |
29 | Connection conn = DriverManager.getConnection("jdbc:mysql://"+DBConfig.HOST+"/"+DBConfig.DATABASE+"?user="+DBConfig.USER+"&password="+DBConfig.PWD); | - | ||
- | 28 | Connection conn = DriverManager.getConnection("jdbc:derby://"+DBConfig.HOST+"/"+DBConfig.DATABASE,DBConfig.USER,DBConfig.PWD); | ||
30 | System.out.println("Conexiune la baza de date realizata."); | 29 | System.out.println("Conexiune la baza de date realizata."); | |
31 | 30 | |||
32 | //inchide cnexiune la baza de date | 31 | //inchide cnexiune la baza de date | |
33 | conn.close(); | 32 | conn.close(); | |
34 | } catch (Exception ex) { | 33 | } catch (Exception ex) { |