2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.database
.types
;
12 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
19 public class PostgreSQLDatabaseType
extends DatabaseTypeBase
{
22 protected String typeName
= "PostgreSQL";
24 protected String classString
= "org.postgresql.Driver";
26 protected String urlString
= "jdbc:postgresql://";
28 private int defaultPort
= 5432;
30 private String hibernateDialect
= "PostgreSQLDialect";
32 private static String dbSeparator
= "/";
35 public String
getConnectionString(ICdmDataSource ds
, int port
){
36 return urlString
+ ds
.getServer() + ":" + port
+ dbSeparator
+ ds
.getDatabase();
40 * @see eu.etaxonomy.cdm.database.types.DatabaseTypeBase#getServerNameByConnectionString(java.lang.String)
43 public String
getDatabaseNameByConnectionString(String connectionString
){
45 result
= getDatabasePartOfConnectionString(connectionString
, dbSeparator
);
47 // int posParams = result.indexOf("?");
48 // if (posParams != -1){
49 // result = result.substring(0, posParams);
58 public PostgreSQLDatabaseType() {
59 init (typeName
, classString
, urlString
, defaultPort
, hibernateDialect
);