当前位置: 首页>>代码示例>>Java>>正文


Java SQLServerDataSource类代码示例

本文整理汇总了Java中com.microsoft.sqlserver.jdbc.SQLServerDataSource的典型用法代码示例。如果您正苦于以下问题:Java SQLServerDataSource类的具体用法?Java SQLServerDataSource怎么用?Java SQLServerDataSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SQLServerDataSource类属于com.microsoft.sqlserver.jdbc包,在下文中一共展示了SQLServerDataSource类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConnectionObject

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
public static Connection getConnectionObject() throws Exception {
	SQLServerDataSource ds = new SQLServerDataSource();
	ds.setServerName("ADMIN-HP");
	ds.setInstanceName("sql2012");
	ds.setDatabaseName("INSINSTANCE");
	ds.setPortNumber(1435);
	ds.setUser("admin");
	ds.setPassword("admin");
	Connection conn;
	try {
		conn = ds.getConnection();
	} catch (SQLServerException e) {
		throw new Exception(e);
	}
	return conn;
	 		
}
 
开发者ID:BhargaviRavula,项目名称:Intelligent-Notification-System,代码行数:18,代码来源:DBConnectionFactory.java

示例2: getDataSourceLocator

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
@Override
public SQLDataSourceLocator getDataSourceLocator() {
    return new SQLDataSourceLocator() {
        public DataSource lookup(SQLDataSetDef def) throws Exception {
            String url = connectionSettings.getProperty("url");
            String user = connectionSettings.getProperty("user");
            String password = connectionSettings.getProperty("password");

            SQLServerDataSource ds = new SQLServerDataSource();
            ds.setURL(url);
            if (!StringUtils.isBlank(user)) {
                ds.setUser(user);
            }
            if (!StringUtils.isBlank(password)) {
                ds.setPassword(password);
            }
            return ds;
        }
    };
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:SQLServerTestSettings.java

示例3: getAdminDataSource

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
/**
 * Returns a DataSource for the master database in the target SQL Server instance.
 * 
 * @since                                   2.0
 */
@Override public DataSource getAdminDataSource()
{
	SQLServerDataSource result = new SQLServerDataSource();
	result.setServerName(this.getHostName());
	if (this.hasInstanceName())
	{
		result.setInstanceName(this.getInstanceName());
	}
	result.setPortNumber(this.getPort());
	result.setUser(this.getAdminUsername());
	result.setPassword(this.getAdminPassword());
	result.setDatabaseName("master");
	
	return result;
}
 
开发者ID:mathesonventures,项目名称:wildebeest,代码行数:21,代码来源:SqlServerDatabaseInstance.java

示例4: getAppDataSource

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
/**
 * Returns a DataSource for the application database defined by this instance.
 * 
 * @since                                   2.0
 */
@Override public DataSource getAppDataSource()
{
	SQLServerDataSource result = new SQLServerDataSource();
	result.setServerName(this.getHostName());
	if (this.hasInstanceName())
	{
		result.setInstanceName(this.getInstanceName());
	}
	result.setPortNumber(this.getPort());
	result.setUser(this.getAdminUsername());
	result.setPassword(this.getAdminPassword());
	result.setDatabaseName(this.getDatabaseName());
	
	return result;
}
 
开发者ID:mathesonventures,项目名称:wildebeest,代码行数:21,代码来源:SqlServerDatabaseInstance.java

示例5: connect

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
@Override
public Connection connect(String system, String port, String database, Generics.ConnectionProperties connectionProperties, String userid, String password)
        throws ClassNotFoundException, SQLException {
    loadDriver();
    SQLServerDataSource ds = new SQLServerDataSource();
    ds.setUser(userid);
    ds.setPassword(password);
    ds.setServerName(system);
    ds.setPortNumber(Integer.parseInt(port));
    ds.setDatabaseName(database);
    setConnection(ds.getConnection());
    return getConnection();
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:14,代码来源:DbMSSQL.java

示例6: SqlServerConnectionProvider

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
public SqlServerConnectionProvider(@NonNls @NotNull final String serverDnsHostName, @NonNls @NotNull final String databaseName, @NonNls @NotNull final String applicationName, @NonNls @NotNull final String userName, @NonNls @NotNull final String password)
{
	sqlServerDataSource = new SQLServerDataSource();
	sqlServerDataSource.setServerName(serverDnsHostName);
	sqlServerDataSource.setDatabaseName(databaseName);
	sqlServerDataSource.setApplicationName(applicationName);
	sqlServerDataSource.setUser(userName);
	sqlServerDataSource.setPassword(password);

	sqlServerDataSource.setLoginTimeout(30);
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:12,代码来源:SqlServerConnectionProvider.java

示例7: dataSourceClassName

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
@Override
public Class<? extends DataSource> dataSourceClassName() {
	return SQLServerDataSource.class;
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:5,代码来源:SQLServerDataSourceProvider.java

示例8: dataSourceClassName

import com.microsoft.sqlserver.jdbc.SQLServerDataSource; //导入依赖的package包/类
@Override
public Class<? extends DataSource> dataSourceClassName() {
    return SQLServerDataSource.class;
}
 
开发者ID:vladmihalcea,项目名称:hibernate-master-class,代码行数:5,代码来源:AbstractTest.java


注:本文中的com.microsoft.sqlserver.jdbc.SQLServerDataSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。