forked from JavaOPs/topjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfiles.java
More file actions
28 lines (24 loc) · 806 Bytes
/
Copy pathProfiles.java
File metadata and controls
28 lines (24 loc) · 806 Bytes
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 ru.javawebinar.topjava;
public class Profiles {
public static final String
POSTGRES = "postgres",
HSQLDB = "hsqldb",
HEROKU = "heroku",
JDBC = "jdbc",
JPA = "jpa",
DATAJPA = "datajpa";
public static final String DB_IMPLEMENTATION = DATAJPA;
public static String getActiveDbProfile() {
try {
Class.forName("org.postgresql.Driver");
return Profiles.POSTGRES;
} catch (ClassNotFoundException ex) {
try {
Class.forName("org.hsqldb.jdbcDriver");
return Profiles.HSQLDB;
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Could not resolve DB profile");
}
}
}
}