(no commit message)
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / database / types / SqlServer2005DatabaseType.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.cdm.database.types;
11
12 import eu.etaxonomy.cdm.database.ICdmDataSource;
13
14
15 /**
16 * @author a.mueller
17 *
18 */
19 public class SqlServer2005DatabaseType extends DatabaseTypeBase {
20
21 //name
22 protected String typeName = "SQL Server";
23
24 //driver class
25 protected String classString = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
26
27 //url
28 protected String urlString = "jdbc:sqlserver://";
29
30 //[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
31
32 //default port
33 private int defaultPort = 1433;
34
35 //hibernate dialect
36 private String hibernateDialect = "SQLServerDialect";
37
38 public String getConnectionString(ICdmDataSource ds, int port){
39 return getConnectionString(ds, port, null);
40 }
41
42 public String getConnectionString(ICdmDataSource ds, int port, String instanceName){
43 String instance = "";
44 if (instanceName != null && ! instanceName.equals("")){
45 instance = "\\" + instanceName;
46 }
47 return urlString + ds.getServer() + instance + ":" + port + ";databaseName=" + ds.getDatabase() +";SelectMethod=cursor";
48 }
49
50 //Constructor
51 public SqlServer2005DatabaseType() {
52 init (typeName, classString, urlString, defaultPort, hibernateDialect );
53 }
54
55 }