本文整理汇总了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;
}
示例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;
}
};
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}