// Copyright (C) 2014 jOVAL.org.  All rights reserved.
// This software is licensed under the LGPL 3.0 license available at http://www.gnu.org/licenses/lgpl.txt

package jsaf.intf.service;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;

import jsaf.intf.identity.ICredential;

/**
 * A session service interface for interacting with a relational database.
 *
 * @author David A. Solin
 * @version %I% %G%
 * @since 1.0
 */
public interface IDatabase {
    /**
     * An enumeration of relational ratabase engines.
     */
    enum Engine {
	DB2("jdbc:db2://", 50000),
	MSSQL("jdbc:sqlserver://", 1433),
	MYSQL("jdbc:mysql://", 3306),
	ORACLE("jdbc:oracle:thin:@//", 1521),
	POSTGRESQL("jdbc:postgresql://", 5432);

	private int port;
	private String prefix;

	private Engine(String prefix, int port) {
	    this.prefix = prefix;
	    this.port = port;
	}

	/**
	 * Return the "prefix" portion of the JDBC connection URL for this engine.
 	 */
	public String getPrefix() {
	    return prefix;
	}

	public int getDefaultPort() {
	    return port;
	}
    }

    /**
     * Get a JDBC connection to the specified database.
     *
     * @param name  Corresponds to the desired Oracle Service Name or DB2/MSSQL/MYSQL/PostgreSQL database instance name.
     * @param cred  The database login credential.
     * @param props Arbitrary JDBC connection properties.
     *
     * @since 1.0
     */
    Connection getConnection(String name, ICredential cred, Properties props) throws SQLException;
}

@@ -567,18 +567,167 @@
 engines.
+ Supplies JDBC URL prefixes for vendor-supplied type-4 drivers,%0D%0A     * except for MS SQL Server and Sybase which assume use of the jTDS JDBC driver.
 %0D%0A
-
      */%0D
@@ -788,16 +788,21 @@
 L(%22jdbc:
+jtds:
 sqlserve
@@ -888,16 +888,16 @@
 1521),%0D%0A
-
 %09POSTGRE
@@ -927,16 +927,55 @@
 %22, 5432)
+,%0D%0A%09SYBASE(%22jdbc:jtds:sybase://%22, 7100)
 ;%0D%0A%0D%0A%09pr

Add Sybase, and use jTDS for MSSQL and Sybase.