mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 06:53:09 +00:00
[DS-2128] Initial commit
This commit is contained in:
@@ -43,9 +43,6 @@ default.language = en_US
|
|||||||
# DATABASE CONFIGURATION #
|
# DATABASE CONFIGURATION #
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
# Database name ("oracle", or "postgres")
|
|
||||||
db.name=postgres
|
|
||||||
|
|
||||||
# Uncomment the appropriate block below for your database.
|
# Uncomment the appropriate block below for your database.
|
||||||
# postgres
|
# postgres
|
||||||
db.driver=org.postgresql.Driver
|
db.driver=org.postgresql.Driver
|
||||||
|
@@ -1143,11 +1143,7 @@ public class LogAnalyser
|
|||||||
public static Integer getNumItems(Context context, String type)
|
public static Integer getNumItems(Context context, String type)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
boolean oracle = false;
|
boolean oracle = DatabaseManager.isOracle();
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
|
||||||
{
|
|
||||||
oracle = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: this method is clearly not optimised
|
// FIXME: this method is clearly not optimised
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ package org.dspace.browse;
|
|||||||
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.core.ConfigurationManager;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory class to generate DAOs based on the configuration
|
* Factory class to generate DAOs based on the configuration
|
||||||
@@ -87,18 +88,13 @@ public class BrowseDAOFactory
|
|||||||
public static BrowseItemDAO getItemInstance(Context context)
|
public static BrowseItemDAO getItemInstance(Context context)
|
||||||
throws BrowseException
|
throws BrowseException
|
||||||
{
|
{
|
||||||
String db = ConfigurationManager.getProperty("db.name");
|
if (! DatabaseManager.isOracle())
|
||||||
if ("postgres".equals(db))
|
|
||||||
{
|
{
|
||||||
return new BrowseItemDAOPostgres(context);
|
return new BrowseItemDAOPostgres(context);
|
||||||
}
|
}
|
||||||
else if ("oracle".equals(db))
|
|
||||||
{
|
|
||||||
return new BrowseItemDAOOracle(context);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new BrowseException("The configuration for db.name is either invalid, or contains an unrecognised database");
|
return new BrowseItemDAOOracle(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,18 +109,13 @@ public class BrowseDAOFactory
|
|||||||
public static BrowseDAOUtils getUtils(Context context)
|
public static BrowseDAOUtils getUtils(Context context)
|
||||||
throws BrowseException
|
throws BrowseException
|
||||||
{
|
{
|
||||||
String db = ConfigurationManager.getProperty("db.name");
|
if (! DatabaseManager.isOracle())
|
||||||
if ("postgres".equals(db))
|
|
||||||
{
|
{
|
||||||
return new BrowseDAOUtilsPostgres();
|
return new BrowseDAOUtilsPostgres();
|
||||||
}
|
}
|
||||||
else if ("oracle".equals(db))
|
else
|
||||||
{
|
{
|
||||||
return new BrowseDAOUtilsOracle();
|
return new BrowseDAOUtilsOracle();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new BrowseException("The configuration for db.name is either invalid, or contains an unrecognised database");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,16 +32,16 @@ import org.dspace.sort.OrderFormat;
|
|||||||
public class BrowseEngine
|
public class BrowseEngine
|
||||||
{
|
{
|
||||||
/** the logger for this class */
|
/** the logger for this class */
|
||||||
private static Logger log = Logger.getLogger(BrowseEngine.class);
|
private static final Logger log = Logger.getLogger(BrowseEngine.class);
|
||||||
|
|
||||||
/** the browse scope which is the basis for our browse */
|
/** the browse scope which is the basis for our browse */
|
||||||
private BrowserScope scope;
|
private BrowserScope scope;
|
||||||
|
|
||||||
/** the DSpace context */
|
/** the DSpace context */
|
||||||
private Context context;
|
private final Context context;
|
||||||
|
|
||||||
/** The Data Access Object for the browse tables */
|
/** The Data Access Object for the browse tables */
|
||||||
private BrowseDAO dao;
|
private final BrowseDAO dao;
|
||||||
|
|
||||||
/** The Browse Index associated with the Browse Scope */
|
/** The Browse Index associated with the Browse Scope */
|
||||||
private BrowseIndex browseIndex;
|
private BrowseIndex browseIndex;
|
||||||
@@ -49,7 +49,7 @@ public class BrowseEngine
|
|||||||
/**
|
/**
|
||||||
* Create a new instance of the Browse engine, using the given DSpace
|
* Create a new instance of the Browse engine, using the given DSpace
|
||||||
* Context object. This will automatically assign a Data Access Object
|
* Context object. This will automatically assign a Data Access Object
|
||||||
* for the Browse Engine, based on the dspace.cfg setting for db.name
|
* for the Browse Engine, based on the brand of the provided DBMS.
|
||||||
*
|
*
|
||||||
* @param context the DSpace context
|
* @param context the DSpace context
|
||||||
* @throws BrowseException
|
* @throws BrowseException
|
||||||
|
@@ -12,7 +12,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
@@ -28,6 +27,7 @@ import org.dspace.discovery.SolrServiceIndexPlugin;
|
|||||||
import org.dspace.sort.OrderFormat;
|
import org.dspace.sort.OrderFormat;
|
||||||
import org.dspace.sort.SortException;
|
import org.dspace.sort.SortException;
|
||||||
import org.dspace.sort.SortOption;
|
import org.dspace.sort.SortOption;
|
||||||
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
import org.dspace.utils.DSpace;
|
import org.dspace.utils.DSpace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,19 +68,13 @@ public class SolrBrowseCreateDAO implements BrowseCreateDAO,
|
|||||||
public SolrBrowseCreateDAO(Context context) throws BrowseException
|
public SolrBrowseCreateDAO(Context context) throws BrowseException
|
||||||
{
|
{
|
||||||
// For compatibility with previous versions
|
// For compatibility with previous versions
|
||||||
String db = ConfigurationManager.getProperty("db.name");
|
if (! DatabaseManager.isOracle())
|
||||||
if ("postgres".equals(db))
|
|
||||||
{
|
{
|
||||||
dbCreateDAO = new BrowseCreateDAOPostgres(context);
|
dbCreateDAO = new BrowseCreateDAOPostgres(context);
|
||||||
}
|
}
|
||||||
else if ("oracle".equals(db))
|
|
||||||
{
|
|
||||||
dbCreateDAO = new BrowseCreateDAOOracle(context);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new BrowseException(
|
dbCreateDAO = new BrowseCreateDAOOracle(context);
|
||||||
"The configuration for db.name is either invalid, or contains an unrecognised database");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@@ -285,7 +285,7 @@ public final class BitstreamInfoDAO extends DAOSupport
|
|||||||
{
|
{
|
||||||
LOG.debug("updating missing bitstreams");
|
LOG.debug("updating missing bitstreams");
|
||||||
conn = DatabaseManager.getConnection();
|
conn = DatabaseManager.getConnection();
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS_ORACLE);
|
stmt = conn.prepareStatement(INSERT_MISSING_CHECKSUM_BITSTREAMS_ORACLE);
|
||||||
}
|
}
|
||||||
@@ -398,7 +398,7 @@ public final class BitstreamInfoDAO extends DAOSupport
|
|||||||
{
|
{
|
||||||
|
|
||||||
conn = DatabaseManager.getConnection();
|
conn = DatabaseManager.getConnection();
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_ORACLE);
|
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_ORACLE);
|
||||||
}
|
}
|
||||||
@@ -445,7 +445,7 @@ public final class BitstreamInfoDAO extends DAOSupport
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
conn = DatabaseManager.getConnection();
|
conn = DatabaseManager.getConnection();
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE_ORACLE);
|
prepStmt = conn.prepareStatement(GET_OLDEST_BITSTREAM_DATE_ORACLE);
|
||||||
}
|
}
|
||||||
|
@@ -111,7 +111,7 @@ public class ChecksumHistoryDAO extends DAOSupport
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
conn = DatabaseManager.getConnection();
|
conn = DatabaseManager.getConnection();
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
stmt = conn.prepareStatement(INSERT_HISTORY_ORACLE);
|
stmt = conn.prepareStatement(INSERT_HISTORY_ORACLE);
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ public class ChecksumHistoryDAO extends DAOSupport
|
|||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS_ORACLE);
|
stmt = conn.prepareStatement(INSERT_MISSING_HISTORY_BITSTREAMS_ORACLE);
|
||||||
}
|
}
|
||||||
|
@@ -180,7 +180,7 @@ public class ReporterDAO extends DAOSupport
|
|||||||
// create the connection and execute the statement
|
// create the connection and execute the statement
|
||||||
conn = DatabaseManager.getConnection();
|
conn = DatabaseManager.getConnection();
|
||||||
|
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
prepStmt = conn.prepareStatement(DATE_RANGE_NOT_PROCESSED_BITSTREAMS_ORACLE);
|
prepStmt = conn.prepareStatement(DATE_RANGE_NOT_PROCESSED_BITSTREAMS_ORACLE);
|
||||||
}
|
}
|
||||||
|
@@ -526,11 +526,7 @@ public class Bitstream extends DSpaceObject
|
|||||||
*/
|
*/
|
||||||
void delete() throws SQLException
|
void delete() throws SQLException
|
||||||
{
|
{
|
||||||
boolean oracle = false;
|
boolean oracle = DatabaseManager.isOracle();
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
|
||||||
{
|
|
||||||
oracle = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// changed to a check on remove
|
// changed to a check on remove
|
||||||
// Check authorisation
|
// Check authorisation
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
package org.dspace.content.dao;
|
package org.dspace.content.dao;
|
||||||
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
@@ -21,7 +21,7 @@ public class ItemDAOFactory
|
|||||||
{
|
{
|
||||||
public static ItemDAO getInstance(Context context)
|
public static ItemDAO getInstance(Context context)
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.getProperty("db.name").equalsIgnoreCase("oracle"))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
return new ItemDAOOracle(context);
|
return new ItemDAOOracle(context);
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
import org.apache.commons.cli.CommandLineParser;
|
|
||||||
import org.apache.commons.cli.GnuParser;
|
import org.apache.commons.cli.GnuParser;
|
||||||
import org.apache.commons.cli.Option;
|
import org.apache.commons.cli.Option;
|
||||||
import org.apache.commons.cli.OptionGroup;
|
import org.apache.commons.cli.OptionGroup;
|
||||||
@@ -60,13 +59,13 @@ public class EPerson extends DSpaceObject
|
|||||||
public static final int LANGUAGE = 5;
|
public static final int LANGUAGE = 5;
|
||||||
|
|
||||||
/** log4j logger */
|
/** log4j logger */
|
||||||
private static Logger log = Logger.getLogger(EPerson.class);
|
private static final Logger log = Logger.getLogger(EPerson.class);
|
||||||
|
|
||||||
/** Our context */
|
/** Our context */
|
||||||
private Context myContext;
|
private final Context myContext;
|
||||||
|
|
||||||
/** The row in the table representing this eperson */
|
/** The row in the table representing this eperson */
|
||||||
private TableRow myRow;
|
private final TableRow myRow;
|
||||||
|
|
||||||
/** Flag set when data is modified, for events */
|
/** Flag set when data is modified, for events */
|
||||||
private boolean modified;
|
private boolean modified;
|
||||||
@@ -295,7 +294,7 @@ public class EPerson extends DSpaceObject
|
|||||||
queryBuf.append("LOWER(firstname) LIKE LOWER(?) OR LOWER(lastname) LIKE LOWER(?) OR LOWER(email) LIKE LOWER(?) ORDER BY lastname, firstname ASC ");
|
queryBuf.append("LOWER(firstname) LIKE LOWER(?) OR LOWER(lastname) LIKE LOWER(?) OR LOWER(email) LIKE LOWER(?) ORDER BY lastname, firstname ASC ");
|
||||||
|
|
||||||
// Add offset and limit restrictions - Oracle requires special code
|
// Add offset and limit restrictions - Oracle requires special code
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
// First prepare the query to generate row numbers
|
// First prepare the query to generate row numbers
|
||||||
if (limit > 0 || offset > 0)
|
if (limit > 0 || offset > 0)
|
||||||
@@ -431,7 +430,7 @@ public class EPerson extends DSpaceObject
|
|||||||
new Object[] {int_param,dbquery,dbquery,dbquery});
|
new Object[] {int_param,dbquery,dbquery,dbquery});
|
||||||
|
|
||||||
// use getIntColumn for Oracle count data
|
// use getIntColumn for Oracle count data
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
count = Long.valueOf(row.getIntColumn("epcount"));
|
count = Long.valueOf(row.getIntColumn("epcount"));
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ public class Group extends DSpaceObject
|
|||||||
public static final int NAME = 1; // sort by NAME (default)
|
public static final int NAME = 1; // sort by NAME (default)
|
||||||
|
|
||||||
/** log4j logger */
|
/** log4j logger */
|
||||||
private static Logger log = Logger.getLogger(Group.class);
|
private static final Logger log = Logger.getLogger(Group.class);
|
||||||
|
|
||||||
/** ID of Anonymous Group */
|
/** ID of Anonymous Group */
|
||||||
public static final int ANONYMOUS_ID = 0;
|
public static final int ANONYMOUS_ID = 0;
|
||||||
@@ -55,10 +55,10 @@ public class Group extends DSpaceObject
|
|||||||
public static final int ADMIN_ID = 1;
|
public static final int ADMIN_ID = 1;
|
||||||
|
|
||||||
/** Our context */
|
/** Our context */
|
||||||
private Context myContext;
|
private final Context myContext;
|
||||||
|
|
||||||
/** The row in the table representing this object */
|
/** The row in the table representing this object */
|
||||||
private TableRow myRow;
|
private final TableRow myRow;
|
||||||
|
|
||||||
/** lists of epeople and groups in the group */
|
/** lists of epeople and groups in the group */
|
||||||
private List<EPerson> epeople = new ArrayList<EPerson>();
|
private List<EPerson> epeople = new ArrayList<EPerson>();
|
||||||
@@ -843,7 +843,7 @@ public class Group extends DSpaceObject
|
|||||||
queryBuf.append("SELECT * FROM epersongroup WHERE LOWER(name) LIKE LOWER(?) OR eperson_group_id = ? ORDER BY name ASC ");
|
queryBuf.append("SELECT * FROM epersongroup WHERE LOWER(name) LIKE LOWER(?) OR eperson_group_id = ? ORDER BY name ASC ");
|
||||||
|
|
||||||
// Add offset and limit restrictions - Oracle requires special code
|
// Add offset and limit restrictions - Oracle requires special code
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
// First prepare the query to generate row numbers
|
// First prepare the query to generate row numbers
|
||||||
if (limit > 0 || offset > 0)
|
if (limit > 0 || offset > 0)
|
||||||
@@ -976,7 +976,7 @@ public class Group extends DSpaceObject
|
|||||||
|
|
||||||
// use getIntColumn for Oracle count data
|
// use getIntColumn for Oracle count data
|
||||||
Long count;
|
Long count;
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
count = Long.valueOf(row.getIntColumn("gcount"));
|
count = Long.valueOf(row.getIntColumn("gcount"));
|
||||||
}
|
}
|
||||||
|
@@ -27,8 +27,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class HarvestedCollection
|
public class HarvestedCollection
|
||||||
{
|
{
|
||||||
private Context context;
|
private final Context context;
|
||||||
private TableRow harvestRow;
|
private final TableRow harvestRow;
|
||||||
|
|
||||||
public static final int TYPE_NONE = 0;
|
public static final int TYPE_NONE = 0;
|
||||||
public static final int TYPE_DMD = 1;
|
public static final int TYPE_DMD = 1;
|
||||||
@@ -238,7 +238,7 @@ public class HarvestedCollection
|
|||||||
public static Integer findOldestHarvest (Context c) throws SQLException {
|
public static Integer findOldestHarvest (Context c) throws SQLException {
|
||||||
String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested asc limit 1";
|
String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested asc limit 1";
|
||||||
|
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested asc";
|
query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested asc";
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ public class HarvestedCollection
|
|||||||
public static Integer findNewestHarvest (Context c) throws SQLException {
|
public static Integer findNewestHarvest (Context c) throws SQLException {
|
||||||
String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested desc limit 1";
|
String query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? order by last_harvested desc limit 1";
|
||||||
|
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested desc";
|
query = "select collection_id from harvested_collection where harvest_type > ? and harvest_status = ? and rownum <= 1 order by last_harvested desc";
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ import java.util.*;
|
|||||||
public class Harvest
|
public class Harvest
|
||||||
{
|
{
|
||||||
/** log4j logger */
|
/** log4j logger */
|
||||||
private static Logger log = Logger.getLogger(Harvest.class);
|
private static final Logger log = Logger.getLogger(Harvest.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain information about items that have been created, modified or
|
* Obtain information about items that have been created, modified or
|
||||||
@@ -173,7 +173,7 @@ public class Harvest
|
|||||||
if (!withdrawn)
|
if (!withdrawn)
|
||||||
{
|
{
|
||||||
// Exclude withdrawn items
|
// Exclude withdrawn items
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
if (DatabaseManager.isOracle())
|
||||||
{
|
{
|
||||||
query += " AND withdrawn=0 ";
|
query += " AND withdrawn=0 ";
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.storage.rdbms;
|
package org.dspace.storage.rdbms;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.Driver;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import javax.sql.DataSource;
|
||||||
import org.apache.commons.dbcp.*;
|
import org.apache.commons.dbcp.*;
|
||||||
import org.apache.commons.pool.ObjectPool;
|
import org.apache.commons.pool.ObjectPool;
|
||||||
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
|
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
|
||||||
@@ -15,13 +20,8 @@ import org.apache.commons.pool.impl.GenericObjectPool;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.core.ConfigurationManager;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.sql.Driver;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class DataSourceInit {
|
public class DataSourceInit {
|
||||||
private static Logger log = Logger.getLogger(DataSourceInit.class);
|
private static final Logger log = Logger.getLogger(DataSourceInit.class);
|
||||||
|
|
||||||
private static DataSource dataSource = null;
|
private static DataSource dataSource = null;
|
||||||
|
|
||||||
@@ -94,12 +94,6 @@ public class DataSourceInit {
|
|||||||
//
|
//
|
||||||
String validationQuery = "SELECT 1";
|
String validationQuery = "SELECT 1";
|
||||||
|
|
||||||
// Oracle has a slightly different validation query
|
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
|
||||||
{
|
|
||||||
validationQuery = "SELECT 1 FROM DUAL";
|
|
||||||
}
|
|
||||||
|
|
||||||
GenericKeyedObjectPoolFactory statementFactory = null;
|
GenericKeyedObjectPoolFactory statementFactory = null;
|
||||||
if (useStatementPool)
|
if (useStatementPool)
|
||||||
{
|
{
|
||||||
@@ -139,6 +133,16 @@ public class DataSourceInit {
|
|||||||
poolingDataSource.setPool(connectionPool);
|
poolingDataSource.setPool(connectionPool);
|
||||||
|
|
||||||
dataSource = poolingDataSource;
|
dataSource = poolingDataSource;
|
||||||
|
|
||||||
|
// Set the proper validation query by DBMS brand.
|
||||||
|
Connection connection = dataSource.getConnection();
|
||||||
|
if ("oracle".equals(connection.getMetaData().getDatabaseProductName().toLowerCase()))
|
||||||
|
{
|
||||||
|
poolableConnectionFactory.setValidationQuery("SELECT 1 FROM DUAL");
|
||||||
|
}
|
||||||
|
connection.close();
|
||||||
|
|
||||||
|
// Ready to use
|
||||||
return poolingDataSource;
|
return poolingDataSource;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@@ -26,18 +26,17 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.apache.log4j.Level;
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.core.ConfigurationManager;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes SQL queries.
|
* Executes SQL queries.
|
||||||
@@ -48,8 +47,8 @@ import org.dspace.core.Context;
|
|||||||
*/
|
*/
|
||||||
public class DatabaseManager
|
public class DatabaseManager
|
||||||
{
|
{
|
||||||
/** log4j category */
|
/** logging category */
|
||||||
private static final Logger log = Logger.getLogger(DatabaseManager.class);
|
private static final Logger log = LoggerFactory.getLogger(DatabaseManager.class);
|
||||||
|
|
||||||
/** True if initialization has been done */
|
/** True if initialization has been done */
|
||||||
private static boolean initialized = false;
|
private static boolean initialized = false;
|
||||||
@@ -59,23 +58,12 @@ public class DatabaseManager
|
|||||||
private static boolean isOracle = false;
|
private static boolean isOracle = false;
|
||||||
private static boolean isPostgres = false;
|
private static boolean isPostgres = false;
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
|
|
||||||
{
|
|
||||||
isOracle = true;
|
|
||||||
isPostgres = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
isOracle = false;
|
|
||||||
isPostgres = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** DataSource (retrieved from jndi */
|
/** DataSource (retrieved from jndi */
|
||||||
private static DataSource dataSource = null;
|
private static DataSource dataSource = null;
|
||||||
|
|
||||||
|
/** Name of the DBMS, as returned by its driver. */
|
||||||
|
private static String dbms;
|
||||||
|
|
||||||
/** Name to use for the pool */
|
/** Name to use for the pool */
|
||||||
private static String poolName = "dspacepool";
|
private static String poolName = "dspacepool";
|
||||||
|
|
||||||
@@ -989,18 +977,12 @@ public class DatabaseManager
|
|||||||
// If the messages are bogus, give them a low priority
|
// If the messages are bogus, give them a low priority
|
||||||
if (isDrop || isNoResults)
|
if (isDrop || isNoResults)
|
||||||
{
|
{
|
||||||
if (log.isDebugEnabled())
|
log.debug(msg, sqle);
|
||||||
{
|
|
||||||
log.debug(msg, sqle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Otherwise, we need to know!
|
// Otherwise, we need to know!
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (log.isEnabledFor(Level.WARN))
|
log.warn(msg, sqle);
|
||||||
{
|
|
||||||
log.warn(msg, sqle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1487,6 +1469,33 @@ public class DatabaseManager
|
|||||||
dataSource = DataSourceInit.getDatasource();
|
dataSource = DataSourceInit.getDatasource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// What brand of DBMS do we have?
|
||||||
|
Connection connection = dataSource.getConnection();
|
||||||
|
DatabaseMetaData meta = connection.getMetaData();
|
||||||
|
dbms = meta.getDatabaseProductName();
|
||||||
|
String dbms_lc = dbms.toLowerCase(Locale.ROOT);
|
||||||
|
if (dbms_lc.contains("postgresql"))
|
||||||
|
{
|
||||||
|
isPostgres = true;
|
||||||
|
log.info("DBMS is PostgreSQL");
|
||||||
|
}
|
||||||
|
else if (dbms_lc.contains("oracle"))
|
||||||
|
{
|
||||||
|
isOracle = true;
|
||||||
|
log.info("DBMS is Oracle Database");
|
||||||
|
}
|
||||||
|
else if (dbms_lc.contains("h2")) // Used in testing
|
||||||
|
{
|
||||||
|
isOracle = true;
|
||||||
|
log.info("DBMS is H2");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.error("DBMS {} is unsupported", dbms);
|
||||||
|
}
|
||||||
|
log.info("DBMS driver version is '{}'", meta.getDatabaseProductVersion());
|
||||||
|
connection.close();
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
catch (SQLException se)
|
catch (SQLException se)
|
||||||
@@ -1503,7 +1512,17 @@ public class DatabaseManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* What is the name of our DBMS?
|
||||||
|
*
|
||||||
|
* @return name returned by the DBMS driver.
|
||||||
|
*/
|
||||||
|
public static String getDbName()
|
||||||
|
{
|
||||||
|
return dbms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Iterate over the given parameters and add them to the given prepared statement.
|
* Iterate over the given parameters and add them to the given prepared statement.
|
||||||
* Only a select number of datatypes are supported by the JDBC driver.
|
* Only a select number of datatypes are supported by the JDBC driver.
|
||||||
*
|
*
|
||||||
|
@@ -11,9 +11,9 @@ import java.io.File;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.utils.DSpace;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command-line executed class for initializing the DSpace database. This should
|
* Command-line executed class for initializing the DSpace database. This should
|
||||||
@@ -25,7 +25,7 @@ import org.dspace.utils.DSpace;
|
|||||||
public class InitializeDatabase
|
public class InitializeDatabase
|
||||||
{
|
{
|
||||||
/** log4j category */
|
/** log4j category */
|
||||||
private static Logger log = Logger.getLogger(InitializeDatabase.class);
|
private static final Logger log = Logger.getLogger(InitializeDatabase.class);
|
||||||
|
|
||||||
public static void main(String[] argv)
|
public static void main(String[] argv)
|
||||||
{
|
{
|
||||||
@@ -61,13 +61,13 @@ public class InitializeDatabase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to get the named script, with the following rules:
|
* Attempt to get the named script, with the following rules:
|
||||||
* etc/<db.name>/<name>
|
* etc/<DBMS name>/<name>
|
||||||
* etc/<name>
|
* etc/<name>
|
||||||
* <name>
|
* <name>
|
||||||
*/
|
*/
|
||||||
private static FileReader getScript(String name) throws FileNotFoundException, IOException
|
private static FileReader getScript(String name) throws FileNotFoundException, IOException
|
||||||
{
|
{
|
||||||
String dbName = new DSpace().getConfigurationService().getProperty("db.name") ;
|
String dbName = DatabaseManager.getDbName().toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
File myFile = null;
|
File myFile = null;
|
||||||
|
|
||||||
|
@@ -10,7 +10,6 @@ package org.dspace.xmlworkflow.storedcomponents;
|
|||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.InProgressSubmission;
|
import org.dspace.content.InProgressSubmission;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
import org.dspace.storage.rdbms.TableRow;
|
import org.dspace.storage.rdbms.TableRow;
|
||||||
@@ -40,15 +39,15 @@ public class XmlWorkflowItem implements InProgressSubmission {
|
|||||||
/*
|
/*
|
||||||
* The current step in the workflow system in which this workflow item is present
|
* The current step in the workflow system in which this workflow item is present
|
||||||
*/
|
*/
|
||||||
private static Logger log = Logger.getLogger(XmlWorkflowItem.class);
|
private static final Logger log = Logger.getLogger(XmlWorkflowItem.class);
|
||||||
|
|
||||||
private Collection collection;
|
private Collection collection;
|
||||||
|
|
||||||
private Item item;
|
private Item item;
|
||||||
|
|
||||||
private TableRow wfRow;
|
private final TableRow wfRow;
|
||||||
|
|
||||||
private Context ourContext;
|
private final Context ourContext;
|
||||||
|
|
||||||
|
|
||||||
public static XmlWorkflowItem create(Context context) throws AuthorizeException, IOException, SQLException {
|
public static XmlWorkflowItem create(Context context) throws AuthorizeException, IOException, SQLException {
|
||||||
@@ -181,7 +180,7 @@ public class XmlWorkflowItem implements InProgressSubmission {
|
|||||||
query.append("WHERE collection_id=").append(collectionId);
|
query.append("WHERE collection_id=").append(collectionId);
|
||||||
}
|
}
|
||||||
int offset = (page - 1) * pagesize;
|
int offset = (page - 1) * pagesize;
|
||||||
if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) {
|
if (DatabaseManager.isOracle()) {
|
||||||
// First prepare the query to generate row numbers
|
// First prepare the query to generate row numbers
|
||||||
if (pagesize > 0 || offset > 0) {
|
if (pagesize > 0 || offset > 0) {
|
||||||
query.insert(0, "SELECT /*+ FIRST_ROWS(n) */ rec.*, ROWNUM rnum FROM (");
|
query.insert(0, "SELECT /*+ FIRST_ROWS(n) */ rec.*, ROWNUM rnum FROM (");
|
||||||
|
@@ -10,9 +10,12 @@ package org.dspace.xoai.services.impl.database;
|
|||||||
import com.lyncode.xoai.dataprovider.filter.Scope;
|
import com.lyncode.xoai.dataprovider.filter.Scope;
|
||||||
import com.lyncode.xoai.dataprovider.filter.ScopedFilter;
|
import com.lyncode.xoai.dataprovider.filter.ScopedFilter;
|
||||||
import com.lyncode.xoai.dataprovider.filter.conditions.Condition;
|
import com.lyncode.xoai.dataprovider.filter.conditions.Condition;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.LogManager;
|
import org.apache.log4j.LogManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
import org.dspace.xoai.services.api.config.ConfigurationService;
|
import org.dspace.xoai.services.api.config.ConfigurationService;
|
||||||
import org.dspace.xoai.services.api.context.ContextService;
|
import org.dspace.xoai.services.api.context.ContextService;
|
||||||
import org.dspace.xoai.services.api.context.ContextServiceException;
|
import org.dspace.xoai.services.api.context.ContextServiceException;
|
||||||
@@ -22,11 +25,8 @@ import org.dspace.xoai.services.api.database.DatabaseQueryResolver;
|
|||||||
import org.dspace.xoai.services.api.xoai.DSpaceFilterResolver;
|
import org.dspace.xoai.services.api.xoai.DSpaceFilterResolver;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DSpaceDatabaseQueryResolver implements DatabaseQueryResolver {
|
public class DSpaceDatabaseQueryResolver implements DatabaseQueryResolver {
|
||||||
private static Logger log = LogManager.getLogger(DSpaceDatabaseQueryResolver.class);
|
private static final Logger log = LogManager.getLogger(DSpaceDatabaseQueryResolver.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DSpaceFilterResolver filterResolver;
|
DSpaceFilterResolver filterResolver;
|
||||||
@@ -61,10 +61,7 @@ public class DSpaceDatabaseQueryResolver implements DatabaseQueryResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY i.item_id";
|
query += " ORDER BY i.item_id";
|
||||||
String db = configurationService.getProperty("db.name");
|
boolean postgres = ! DatabaseManager.isOracle();
|
||||||
boolean postgres = true;
|
|
||||||
// Assuming Postgres as default
|
|
||||||
if ("oracle".equals(db)) postgres = false;
|
|
||||||
if (postgres)
|
if (postgres)
|
||||||
{
|
{
|
||||||
query += " OFFSET ? LIMIT ?";
|
query += " OFFSET ? LIMIT ?";
|
||||||
|
@@ -13,7 +13,6 @@ import org.dspace.core.Context;
|
|||||||
import org.dspace.storage.rdbms.DatabaseManager;
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
import org.dspace.storage.rdbms.TableRowIterator;
|
import org.dspace.storage.rdbms.TableRowIterator;
|
||||||
import org.dspace.xoai.exceptions.InvalidMetadataFieldException;
|
import org.dspace.xoai.exceptions.InvalidMetadataFieldException;
|
||||||
import org.dspace.xoai.services.api.config.ConfigurationService;
|
|
||||||
import org.dspace.xoai.services.api.database.EarliestDateResolver;
|
import org.dspace.xoai.services.api.database.EarliestDateResolver;
|
||||||
import org.dspace.xoai.services.api.database.FieldResolver;
|
import org.dspace.xoai.services.api.database.FieldResolver;
|
||||||
import org.dspace.xoai.util.DateUtils;
|
import org.dspace.xoai.util.DateUtils;
|
||||||
@@ -23,22 +22,15 @@ import java.sql.SQLException;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class DSpaceEarliestDateResolver implements EarliestDateResolver {
|
public class DSpaceEarliestDateResolver implements EarliestDateResolver {
|
||||||
private static Logger log = LogManager.getLogger(DSpaceEarliestDateResolver.class);
|
private static final Logger log = LogManager.getLogger(DSpaceEarliestDateResolver.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FieldResolver fieldResolver;
|
private FieldResolver fieldResolver;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ConfigurationService configurationService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getEarliestDate(Context context) throws InvalidMetadataFieldException, SQLException {
|
public Date getEarliestDate(Context context) throws InvalidMetadataFieldException, SQLException {
|
||||||
String query = "SELECT MIN(text_value) as value FROM metadatavalue WHERE metadata_field_id = ?";
|
String query = "SELECT MIN(text_value) as value FROM metadatavalue WHERE metadata_field_id = ?";
|
||||||
String db = configurationService.getProperty("db.name");
|
boolean postgres = ! DatabaseManager.isOracle();
|
||||||
boolean postgres = true;
|
|
||||||
// Assuming Postgres as default
|
|
||||||
if ("oracle".equals(db))
|
|
||||||
postgres = false;
|
|
||||||
|
|
||||||
if (!postgres) {
|
if (!postgres) {
|
||||||
query = "SELECT MIN(TO_CHAR(text_value)) as value FROM metadatavalue WHERE metadata_field_id = ?";
|
query = "SELECT MIN(TO_CHAR(text_value)) as value FROM metadatavalue WHERE metadata_field_id = ?";
|
||||||
|
@@ -15,7 +15,6 @@ import java.util.Comparator;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.avalon.framework.activity.Disposable;
|
import org.apache.avalon.framework.activity.Disposable;
|
||||||
import org.apache.avalon.framework.service.ServiceException;
|
import org.apache.avalon.framework.service.ServiceException;
|
||||||
import org.apache.avalon.framework.service.ServiceManager;
|
import org.apache.avalon.framework.service.ServiceManager;
|
||||||
@@ -42,10 +41,11 @@ import org.dspace.app.xmlui.wing.element.Table;
|
|||||||
import org.dspace.app.xmlui.wing.element.TextArea;
|
import org.dspace.app.xmlui.wing.element.TextArea;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.authorize.AuthorizeManager;
|
import org.dspace.authorize.AuthorizeManager;
|
||||||
import org.dspace.harvest.HarvestedCollection;
|
|
||||||
import org.dspace.harvest.OAIHarvester.HarvestScheduler;
|
|
||||||
import org.dspace.core.ConfigurationManager;
|
import org.dspace.core.ConfigurationManager;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
|
import org.dspace.harvest.HarvestedCollection;
|
||||||
|
import org.dspace.harvest.OAIHarvester.HarvestScheduler;
|
||||||
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -510,7 +510,7 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
|||||||
dspace.addItem(notnull(ConfigurationManager.getProperty("dspace.name")));
|
dspace.addItem(notnull(ConfigurationManager.getProperty("dspace.name")));
|
||||||
|
|
||||||
dspace.addLabel(T_DB_NAME);
|
dspace.addLabel(T_DB_NAME);
|
||||||
dspace.addItem(notnull(ConfigurationManager.getProperty("db.name")));
|
dspace.addItem(notnull(DatabaseManager.getDbName()));
|
||||||
|
|
||||||
dspace.addLabel(T_DB_URL);
|
dspace.addLabel(T_DB_URL);
|
||||||
dspace.addItem(notnull(ConfigurationManager.getProperty("db.url")));
|
dspace.addItem(notnull(ConfigurationManager.getProperty("db.url")));
|
||||||
|
@@ -50,9 +50,6 @@ default.language = ${default.language}
|
|||||||
|
|
||||||
##### Database settings #####
|
##### Database settings #####
|
||||||
|
|
||||||
# Database name ("oracle", or "postgres")
|
|
||||||
db.name = ${db.name}
|
|
||||||
|
|
||||||
# URL for connecting to database
|
# URL for connecting to database
|
||||||
db.url = ${db.url}
|
db.url = ${db.url}
|
||||||
|
|
||||||
@@ -89,7 +86,7 @@ db.poolname = ${db.poolname}
|
|||||||
# Specify a configured database connection pool to be fetched from a
|
# Specify a configured database connection pool to be fetched from a
|
||||||
# directory. This overrides the pool and driver settings above. If
|
# directory. This overrides the pool and driver settings above. If
|
||||||
# none can be found, then DSpace will use the above settings to create a
|
# none can be found, then DSpace will use the above settings to create a
|
||||||
# pool. db.name should be specified regardless.
|
# pool.
|
||||||
#db.jndi = jdbc/dspace
|
#db.jndi = jdbc/dspace
|
||||||
|
|
||||||
##### Email settings ######
|
##### Email settings ######
|
||||||
|
@@ -7,9 +7,8 @@ Revision: 11-sep-04 dstuve
|
|||||||
Oracle Porting Notes for the Curious
|
Oracle Porting Notes for the Curious
|
||||||
|
|
||||||
Oracle is missing quite a number of cool features found in Postgres, so
|
Oracle is missing quite a number of cool features found in Postgres, so
|
||||||
workarounds had to be found, most of which are hidden behind tests of
|
workarounds had to be found, most of which are hidden behind tests in
|
||||||
the db.name configuration parameter in dspace.cfg. If the db.name is
|
DatabaseManager. If Oracle is your DBMS, the workarounds are activated:
|
||||||
set to Oracle the workarounds are activated:
|
|
||||||
|
|
||||||
Oracle doesn't like ';' characters in JDBC SQL - they have all been removed
|
Oracle doesn't like ';' characters in JDBC SQL - they have all been removed
|
||||||
from the DSpace source, including code in the .sql file reader to strip ;'s.
|
from the DSpace source, including code in the .sql file reader to strip ;'s.
|
||||||
@@ -18,8 +17,8 @@ browse code - LIMIT and OFFSET is used to limit browse results, and an
|
|||||||
Oracle-hack is used to limit the result set to a given size
|
Oracle-hack is used to limit the result set to a given size
|
||||||
|
|
||||||
Oracle has no boolean data type, so a new schema file was created that
|
Oracle has no boolean data type, so a new schema file was created that
|
||||||
uses NUMBER(1) (AKA 'integers') and code is inserted everywhere to use 0 for false
|
uses NUMBER(1) (AKA 'integers') and code is inserted everywhere to use 0 for
|
||||||
and 1 for true if the db.name is Oracle
|
false and 1 for true if DSpace is using Oracle.
|
||||||
|
|
||||||
Oracle doesn't have a TEXT data type either, so TEXT columns are defined
|
Oracle doesn't have a TEXT data type either, so TEXT columns are defined
|
||||||
as VARCHAR2 in the Oracle-specific schema.
|
as VARCHAR2 in the Oracle-specific schema.
|
||||||
|
Reference in New Issue
Block a user