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


Java SQLServerConnection类代码示例

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


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

示例1: flushVertexGlobalUniqueIndexes

import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
@Override
public void flushVertexGlobalUniqueIndexes(SqlgGraph sqlgGraph, Map<SchemaTable, Pair<SortedSet<String>, Map<SqlgVertex, Map<String, Object>>>> vertexCache) {
    for (SchemaTable schemaTable : vertexCache.keySet()) {
        Pair<SortedSet<String>, Map<SqlgVertex, Map<String, Object>>> vertices = vertexCache.get(schemaTable);
        Map<String, PropertyColumn> propertyColumnMap = sqlgGraph.getTopology().getPropertiesFor(schemaTable.withPrefix(VERTEX_PREFIX));
        for (Map.Entry<String, PropertyColumn> propertyColumnEntry : propertyColumnMap.entrySet()) {
            PropertyColumn propertyColumn = propertyColumnEntry.getValue();
            for (GlobalUniqueIndex globalUniqueIndex : propertyColumn.getGlobalUniqueIndices()) {
                try {
                    Connection connection = sqlgGraph.tx().getConnection();
                    SQLServerConnection sqlServerConnection = connection.unwrap(SQLServerConnection.class);
                    try (SQLServerBulkCopy bulkCopy = new SQLServerBulkCopy(sqlServerConnection)) {
                        bulkCopy.setDestinationTableName(sqlgGraph.getSqlDialect().maybeWrapInQoutes(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA) + "." +
                                sqlgGraph.getSqlDialect().maybeWrapInQoutes(VERTEX_PREFIX + globalUniqueIndex.getName())
                        );
                        bulkCopy.writeToServer(new SQLServerVertexGlobalUniqueIndexBulkRecord(bulkCopy, sqlgGraph, vertices, propertyColumn));
                    }
                } catch (SQLException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:25,代码来源:MSSqlServerDialect.java

示例2: wrapSqlServerConnection

import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
/**
 * Wrap a SQL server connection
 * @param conn the connection
 * @return the wrapped connection
 */
public static Connection wrapSqlServerConnection(Connection conn) {
	if ((conn instanceof WrappedConnection)) {
		return conn;
	}
	
	if ((conn instanceof SQLServerConnection)) {
		return new WrappedSQLServerConnection((SQLServerConnection) conn);
	}

	return new WrappedConnection(conn);
}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:17,代码来源:WrappedSQLServerPooledConnection.java

示例3: isolationLevels

import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
@Parameterized.Parameters
public static Collection<Object[]> isolationLevels() {
    List<Object[]> levels = new ArrayList<>();
    levels.add(new Object[]{"Read Uncommitted", Connection.TRANSACTION_READ_UNCOMMITTED});
    levels.add(new Object[]{"Read Committed", Connection.TRANSACTION_READ_COMMITTED});
    levels.add(new Object[]{"Repeatable Read", Connection.TRANSACTION_REPEATABLE_READ});
    levels.add(new Object[]{"Serializable", Connection.TRANSACTION_SERIALIZABLE});
    levels.add(new Object[]{"Read Committed Snapshot Isolation", SQLServerConnection.TRANSACTION_READ_COMMITTED});
    levels.add(new Object[]{"Snapshot Isolation", SQLServerConnection.TRANSACTION_SNAPSHOT});
    return levels;
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:12,代码来源:SQLServerPhenomenaTest.java

示例4: flushEdgeGlobalUniqueIndexes

import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
@Override
public void flushEdgeGlobalUniqueIndexes(SqlgGraph sqlgGraph,
                                         Map<MetaEdge, Pair<SortedSet<String>, Map<SqlgEdge, Triple<SqlgVertex, SqlgVertex, Map<String, Object>>>>> edgeCache) {
    for (MetaEdge metaEdge : edgeCache.keySet()) {

        Pair<SortedSet<String>, Map<SqlgEdge, Triple<SqlgVertex, SqlgVertex, Map<String, Object>>>> triples = edgeCache.get(metaEdge);
        Map<SqlgEdge, Triple<SqlgVertex, SqlgVertex, Map<String, Object>>> edgeMap = triples.getRight();
        Map<String, PropertyColumn> propertyColumnMap = sqlgGraph.getTopology().getPropertiesFor(metaEdge.getSchemaTable().withPrefix(EDGE_PREFIX));

        for (Map.Entry<String, PropertyColumn> propertyColumnEntry : propertyColumnMap.entrySet()) {
            PropertyColumn propertyColumn = propertyColumnEntry.getValue();
            for (GlobalUniqueIndex globalUniqueIndex : propertyColumn.getGlobalUniqueIndices()) {
                try {
                    Connection connection = sqlgGraph.tx().getConnection();
                    SQLServerConnection sqlServerConnection = connection.unwrap(SQLServerConnection.class);
                    try (SQLServerBulkCopy bulkCopy = new SQLServerBulkCopy(sqlServerConnection)) {
                        bulkCopy.setDestinationTableName(sqlgGraph.getSqlDialect().maybeWrapInQoutes(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA) + "." +
                                sqlgGraph.getSqlDialect().maybeWrapInQoutes(VERTEX_PREFIX + globalUniqueIndex.getName())
                        );
                        bulkCopy.writeToServer(new SQLServerEdgeGlobalUniqueIndexBulkRecord(bulkCopy, sqlgGraph, edgeMap, propertyColumn));
                    }
                } catch (SQLException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:29,代码来源:MSSqlServerDialect.java


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