2 * Copyright (c) 2016, 2017 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.aaa.datastore.h2;
10 import java.sql.Connection;
11 import java.sql.DriverManager;
12 import java.sql.SQLException;
15 * Simple Provider of JDBC Connections, based on an {@link IdmLightConfig} and
16 * {@link DriverManager}.
18 * @author Michael Vorburger
20 public class IdmLightSimpleConnectionProvider implements ConnectionProvider {
21 private final IdmLightConfig config;
23 public IdmLightSimpleConnectionProvider(IdmLightConfig config) {
29 public Connection getConnection() throws StoreException {
31 return DriverManager.getConnection(config.getDbConnectionString(), config.getDbUser(), config.getDbPwd());
32 } catch (SQLException e) {
33 throw new StoreException("Cannot connect to database server", e);