File DestinationDBHibernate.cfg.xml in "cfg" folder of the project renamed in DestinationDBHibernateDBManager.cfg.xml and correction in method initDBSession of the ConectionMannaager class in order to specify this file name.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-access/DatabasesResourcesManager@99649 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-09-10 07:57:17 +00:00
parent b72e647ea8
commit 77082fa4ad
3 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8'?>
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="connection.url">jdbc:mysql://146.48.87.169/timeseries</property>
<property name="connection.username">root</property>
<property name="connection.password">test</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="c3p0.timeout">0</property>
<property name="c3p0.checkoutTimeout">0</property>
<property name="c3p0.acquireRetryAttempts">1</property>
<property name="c3p0.max_size">1</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">1</property>
<property name="current_session_context_class">thread</property>
</session-factory>
</hibernate-configuration>

View File

@ -44,7 +44,7 @@ public class ConnectionManager {
try {
if ((config != null) && (config.getConfigPath() != null)) {
String defaultDatabaseFile = config.getConfigPath()
+ AlgorithmConfiguration.defaultConnectionFile;
+ "DestinationDBHibernateDBManager.cfg.xml";
config.setDatabaseDriver(config.getParam("DatabaseDriver"));
config.setDatabaseUserName(config.getParam("DatabaseUserName"));
@ -74,6 +74,7 @@ public class ConnectionManager {
}
// create the database's connection using the configuration file
// Note that this method is not called actually.
public SessionFactory initDBConnection(String configurationFile)
throws Exception {
String xml = FileTools.readXMLDoc(configurationFile);

View File

@ -270,6 +270,7 @@ public class DatabaseManagement {
// create the database's connection using the configuration file.
// note that for database postgres the variable sourceSchemaName is set to
// the schema's name.
// Note that this method is not called actually
public SessionFactory createConnection(String cfgDir, String SourceFile)
throws Exception {