我将获得所有用户的列表,包括Windows用户和"sa",他们可以访问MS SQL Server中的特定数据库.基本上,我希望列表看起来像显示的内容SQL Server Management Studio
(即展开时显示的列表[databse] -> Security -> Users
),但有一个重要的例外:我不想'dbo'
在列表中看到它.相反,我希望看到拥有数据库的实际用户.因此,例如,如果'sa'是'dbo'
,则'sa'
必须包含在列表中而不是'dbo'
.另一个不容错过的注意事项是,SQL Server Management Studio
除了SQL用户之外,通常还会显示Windows用户中的列表,并且我希望也包含这些用户.
到目前为止,我已经能够提出以下查询:
SELECT * FROM sys.database_principals where (type='S' or type = 'U')
Run Code Online (Sandbox Code Playgroud)
这个查询几乎是正确的,但问题是它不满足'dbo'
条件.
如何更改此查询或应该使用其他查询?
我正在开发一个大型ERP项目,该项目拥有大约2100个表的数据库模型.使用Hibernate映射的"仅"500个表,部署在Web服务器上的应用程序需要大约3GB的工作内存.
在一个持久性单元中使用那么多表时,有没有办法减少Hibernate的元模型内存占用?或者我应该放弃ORM并使用普通的旧JDBC(甚至是jOOQ)?
现在我正在使用Hibernate 4.1.8,Spring 3.1.3,JBoss AS 7.1并使用MSSQL数据库.
编辑:
JavaMelody内存直方图输出 - 使用2000个生成的测试表,这些测试表的范围比原始数据库模型小一点(因此'仅花费了1.3GB的内存)
编辑2:
Java MAT堆分析:
在执行了几个查询后,我从Hibernate获得以下消息:
HHH000106: Forcing container resource cleanup on transaction completion
Run Code Online (Sandbox Code Playgroud)
一切似乎工作正常,没有错误,但我没有找到任何解释这个消息的含义,或者我是否应该做任何事情.
我正在使用Hibernate/JPA和JTA全局事务.
有任何想法吗?
我成功地通过http://blog.springsource.com/2007/01/23/dynamic-datasource-routing/文章实现了动态更改数据库连接.
但现在问题是,我在配置文件中有一个由遗留应用程序管理的数据库URL列表.
有没有办法从值列表(即Year2011DataSource,Year2012DataSource,...)在Spring上下文中创建bean,并使用刚刚创建的那些bean填充dataSource bean的映射?
<!-- Property file located in the legacy application's folder -->
<context:property-placeholder location="file:///D:/config.properties" />
<!-- Shared data source properties are read from the config.properties file -->
<bean id="parentDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" abstract="true">
<property name="driverClassName" value="${db.driver}" />
<property name="username" value="${db.user}" />
<property name="password" value="${db.password}" />
</bean>
<!-- Database urls by year -->
<bean id="Year2012DataSource" parent="parentDataSource">
<property name="url" value="jdbc:sqlserver://localhost;databaseName=DbName_v570_2012" />
</bean>
<bean id="Year2011DataSource" parent="parentDataSource">
<property name="url" value="jdbc:sqlserver://localhost;databaseName=DbName_v570_2011" />
</bean>
<bean id="Year2010DataSource" parent="parentDataSource">
<property name="url" value="jdbc:sqlserver://localhost;databaseName=DbName_v570_2010" />
</bean>
<!-- ... …
Run Code Online (Sandbox Code Playgroud) 角度组件
public setupObservables() {
this.formFieldChanged$ = this.formField
.valueChanges
.pipe(
debounceTime(100),
distinctUntilChanged((a, b) => a === b),
)
}
Run Code Online (Sandbox Code Playgroud)
茉莉花测试
import { of } from 'rxjs';
import { marbles } from 'rxjs-marbles/jasmine';
...
it('should update value on debounced formField change', marbles(m => {
const values = { a: "1", b: "2", c: "3" };
const fakeInputs = m.cold('a 200ms b 50ms c', values);
const expected = m.cold('100ms a 250ms c', values);
// works on stackblitz but otherwise gives TS2540 compiler error …
Run Code Online (Sandbox Code Playgroud) 尝试使用html-loader插件在TypeScript中导入html :
import buttonHtml from './button.html';
Run Code Online (Sandbox Code Playgroud)
出现TypeScript错误:
TS2307:找不到模块'./button.html'
Webpack配置:
const path = require('path');
module.exports = {
entry: {
'background.js':path.resolve(__dirname, './background.ts'),
'content.js': path.resolve(__dirname,'./content.ts')
},
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.html$/,
exclude: /node_modules/,
use: {loader: 'html-loader'}
}
]
},
resolve: {
extensions: [ ".tsx", ".ts", ".js" ]
},
output: {
filename: '[name]',
path: path.resolve(__dirname, 'dist')
}
};
Run Code Online (Sandbox Code Playgroud) html typescript webpack webpack-html-loader typescript-typings
当我通过Spring的Hessian函数调用返回BigDecimal值的远程方法时,它总是返回零.直接调用方法或使用普通的Hessian servlet(非Spring)正常工作.
可以做些什么来解决这个问题?
web.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<servlet>
<servlet-name>remoting</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>remoting</servlet-name>
<url-pattern>/remoting/*</url-pattern>
</servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
远程-servlet.xml中:
<beans>
<context:annotation-config />
<context:component-scan base-package="hr.spi.logic.lcspi" />
<tx:annotation-driven proxy-target-class="true" />
<bean name="/lcspi/lc302/poslovi" class="org.springframework.remoting.caucho.HessianServiceExporter">
<property name="service" ref="posloviLogic" />
<property name="serviceInterface" value="hr.spi.logic.lcspi.lc302.PosloviLogicInterface" />
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
我调用的方法的服务类:
package hr.spi.logic.lcspi.lc302;
@Transactional
@Repository
public class PosloviLogic implements PosloviLogicInterface {
@Override
public BigDecimal test()
{
BigDecimal bd = new BigDecimal("2.2");
return bd;
}
}
Run Code Online (Sandbox Code Playgroud)
Spring配置 - applicationContextHessian.xml:
<beans> …
Run Code Online (Sandbox Code Playgroud) 我的文件网址如下。首先,我要下载文件的内容。该文件已从SSRS配置下钻取。之后,我用代码打开一个流app.Workbooks.Open(stream);
using (var client = new WebClient())
{
var content = client.DownloadData(url); // Get Existing file
Stream stream = new MemoryStream(content);
stream.Position = 0;
using (ExcelEngine xlsEngine = new ExcelEngine())
{
IApplication app = xlsEngine.Excel;
IWorkbook workBook = app.Workbooks.Open(stream);
}
}
Run Code Online (Sandbox Code Playgroud)
Syncfusion版本:
Syncfusion.XlsIO.Base, Version=15.4460.0.20
Run Code Online (Sandbox Code Playgroud)
题:
如果我尝试从现有流中创建新工作簿(SSRS报告已向下钻取)文件,则会出现以下错误
object not set to an instance of an object
Run Code Online (Sandbox Code Playgroud) java ×4
spring ×3
hibernate ×2
angular ×1
c# ×1
excel ×1
hessian ×1
html ×1
jasmine ×1
jpa ×1
memory ×1
rxjs ×1
rxjs-marbles ×1
sql-server ×1
syncfusion ×1
typescript ×1
webpack ×1