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 org.hibernate.dialect.Dialect;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
|
16
|
|
17
|
/**
|
18
|
* TODO not tested yet !!
|
19
|
*
|
20
|
* @author a.mueller
|
21
|
*
|
22
|
*/
|
23
|
public class OdbcDatabaseType extends DatabaseTypeBase {
|
24
|
|
25
|
//typeName
|
26
|
protected String typeName = "ODBC";
|
27
|
|
28
|
//class
|
29
|
protected String classString = "sun.jdbc.odbc.JdbcOdbcDriver";
|
30
|
|
31
|
//url
|
32
|
protected String urlString = "jdbc:odbc:";
|
33
|
|
34
|
//port
|
35
|
private int defaultPort = 0;
|
36
|
|
37
|
//hibernate dialect
|
38
|
//TODO
|
39
|
private Dialect hibernateDialect = null;
|
40
|
|
41
|
//connection String
|
42
|
public String getConnectionString(ICdmDataSource ds, int port){
|
43
|
return urlString + ds.getServer() ;
|
44
|
}
|
45
|
|
46
|
/* (non-Javadoc)
|
47
|
* @see eu.etaxonomy.cdm.database.types.IDatabaseType#getPortByConnectionString(java.lang.String)
|
48
|
*/
|
49
|
public int getPortByConnectionString(String connectionString){
|
50
|
return -1; //ODBC does not have any port
|
51
|
}
|
52
|
|
53
|
/* (non-Javadoc)
|
54
|
* @see eu.etaxonomy.cdm.database.types.DatabaseTypeBase#getServerNameByConnectionString(java.lang.String)
|
55
|
*/
|
56
|
@Override
|
57
|
public String getDatabaseNameByConnectionString(String connectionString){
|
58
|
//TODO does ODBC have a database name?
|
59
|
return null;
|
60
|
}
|
61
|
|
62
|
/* (non-Javadoc)
|
63
|
* @see eu.etaxonomy.cdm.database.types.IDatabaseType#getServerNameByConnectionString(java.lang.String)
|
64
|
*/
|
65
|
public String getServerNameByConnectionString(String connectionString){
|
66
|
String result = null;
|
67
|
if (connectionString != null){
|
68
|
result = connectionString.substring(urlString.length());
|
69
|
|
70
|
}
|
71
|
return result;
|
72
|
}
|
73
|
|
74
|
|
75
|
//constructor
|
76
|
public OdbcDatabaseType() {
|
77
|
init (typeName, classString, urlString, defaultPort, hibernateDialect );
|
78
|
}
|
79
|
|
80
|
|
81
|
|
82
|
|
83
|
}
|