Project

General

Profile

Download (1.76 KB) Statistics
| Branch: | Tag: | Revision:
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
import org.hibernate.dialect.SybaseDialect;
14

    
15
import eu.etaxonomy.cdm.database.ICdmDataSource;
16

    
17

    
18
/**
19
 * !! UNTESTED !!
20
 * @author a.mueller
21
 *
22
 */
23
public class SybaseDatabaseType extends DatabaseTypeBase {
24

    
25
	//typeName
26
	protected String typeName = "Sybase";
27
	//class
28
	protected String classString = "com.sybase.jdbc2.jdbc.SybDriver";
29
	//url
30
    protected String urlString = "jdbc:sybase:Tds:";
31
    //port
32
    private int defaultPort = 4100;
33
    //hibernate dialect
34
    private Dialect hibernateDialect = new SybaseDialect();
35

    
36
    private static String dbSeparator = "/";
37
    
38
    //connection String
39
	public String getConnectionString(ICdmDataSource ds, int port){
40
        return urlString + ds.getServer()+ ":" + port + dbSeparator + ds.getDatabase();
41
    }
42
	
43
    /* (non-Javadoc)
44
     * @see eu.etaxonomy.cdm.database.types.DatabaseTypeBase#getServerNameByConnectionString(java.lang.String)
45
     */
46
	@Override
47
    public String getDatabaseNameByConnectionString(String connectionString){
48
    	String result;
49
    	result = getDatabasePartOfConnectionString(connectionString, dbSeparator);
50
    	//TODO
51
//    	int posParams = result.indexOf("?");
52
//    	if (posParams != -1){
53
//    		result = result.substring(0, posParams);
54
//    	}
55
     	return result;
56
    }   
57
    
58
    public SybaseDatabaseType() {
59
    	init (typeName, classString, urlString, defaultPort,  hibernateDialect );
60
	}
61

    
62

    
63

    
64

    
65
}
(14-14/14)