嗨,有些人可以告诉我为什么我们为索引和数据创建了不同的表空间.
我使用Microsoft SQL Server JDBC Driver 2.0通过Java连接到SQL Server(2005).
如何从存储过程中获取返回值?我做的事情如下:
Connection connection = dataSource.getConnection()
CallableStatement proc = connection.prepareCall("{ call dbo.mySproc() }");
proc.execute();
Run Code Online (Sandbox Code Playgroud)
我应该使用execute()吗?的executeQuery()?的executeUpdate()?这些似乎都没有默认返回值,但我不确定如何实现它.
编辑1:要清楚,我知道如何调用存储过程.这个问题具体是关于如何获得返回值(而不是结果集).返回值是一个整数,通常在执行没有结果集的查询时生成,或者您RETURN 0在SQL中特别声明了类似的内容.
编辑2:executeUpdate()返回一个int,但是这个int与返回值不同.此外,OUT参数与返回值不同.
我想知道如何使用Java获取解释计划.我需要这个的原因是因为我们有一个特殊用户可以制作报告的框架.这些报告有时会构建大量查询,我们希望在其中动态解释并存储成本.这样我们就可以在以后分析高成本查询并进行优化.
给出非法列异常的示例代码:
ResultSet rs = null;
try {
oracle = ConnectionManager.getConnection(ConnectionManager.Test);
pstmt = oracle.prepareStatement("begin execute immediate
'explain plan for SELECT 1 from Dual'; end;");
rs = pstmt.executeQuery();
while (rs.next()) {
System.out.println(rs.getString(1));
}
Run Code Online (Sandbox Code Playgroud) 有谁知道是否有可能从速度不同的路径获取模板?初始化后,Velocity拒绝更改"file.resource.loader.path".
这是我的代码:
public Generator(){
Properties p = new Properties();
p.setProperty("resource.loader", "file");
p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
p.setProperty("file.resource.loader.path", "");
Velocity.init(p);
}
Run Code Online (Sandbox Code Playgroud)
模板可以位于不同的位置(用户可以选择带有文件对话框的模板).所以我在从速度中取出模板时有这个代码
private Template fetch (String templatePath) {
out_println("Initializing Velocity core...");
int end = templatePath.lastIndexOf(File.separator);
Properties p = new Properties();
p.setProperty("file.resource.loader.path", templatePath.substring(0, end));
Velocity.init(p);
return Velocity.getTemplate(templatePath.substring(end+1));
}
Run Code Online (Sandbox Code Playgroud)
这不起作用.似乎一旦Velocity初始化,它就不能用不同的属性重置.有关如何解决这个问题的任何建议?
可能的计划流程:
我有一个经典的asp页面的问题,我从3天后就无法解决它.
该页面正在使用Sessions - 有时会发生ASPSESSIONID cookie在Request.ServerVariables("HTTP_COOKIE")中设置两次.这会导致ASP页面在刷新页面时在两个Sessions之间跳转.
我编写了一个测试页面,输出当前的SessionId,服务器软件和HTTP_COOKIE值.
样本输出:
会议ID:308542840
会话超时:20分钟
服务器软件:Microsoft-IIS/6.0
HTTP_COOKIE:ASPSESSIONIDQCBATRAD = MBHHDGCBGGBJBMAEGLDAJLGF; ASPSESSIONIDQCCDTTCB = PGHPDGCBPLKALGGKIPOFIGDM
为什么有两个ASPSESSIONID?当我刷新页面时,它随机输出两个会话ID中的一个.
这是一个在IE9中显示问题的截屏视频:http: //prinz-alexander.at/asp_test.avi
此错误通常发生在ie8和ie9中.
只需执行以下操作即可重新创建问题:
如果您重复此步骤,则随机(并非总是)HTTP_COOKIE将填充两个不同的ASPSESSIONID.
asp测试文件只输出mentiod值,源代码中没有其他任何内容.
这是asp测试文件的代码:
<% If trim(Session("test_val")) = "" Then
Dim my_num
Randomize
number = Int((rnd*1000))+1
Session("test_val") = number
End If
%>
<b>Session ID:</b>
<% response.write(Session.SessionId) %><br /><br />
<b>Session("test_val"):</b>
<% response.write(Session("test_val")) %><br /><br />
<b>Session Timeout:</b>
<% response.write(Session.Timeout) %> minutes<br /><br />
<b>Server Software:</b>
<% response.write(Request.ServerVariables("SERVER_SOFTWARE")) %><br /> <br />
<b>HTTP_COOKIE:</b> <% response.write(Request.ServerVariables("HTTP_COOKIE")) …Run Code Online (Sandbox Code Playgroud) 我需要使用BigInteger,但在kotlin中找不到类似的东西.
在kotlin中有没有替代类到BigInteger的java?
要么
我应该将java类导入kotlin吗?
所有!
我在LinkedBlockingQueue中发现了奇怪的代码:
private E dequeue() {
// assert takeLock.isHeldByCurrentThread();
Node<E> h = head;
Node<E> first = h.next;
h.next = h; // help GC
head = first;
E x = first.item;
first.item = null;
return x;
}
Run Code Online (Sandbox Code Playgroud)
谁能解释为什么我们需要局部变量h?它对GC有什么帮助?
Kotlin委托了属性,这是一个非常好的功能.但有时get()和set()方法是不够的.假设我想Closeable懒惰地创建一个对象并稍后关闭它.以下是如何实现此类委托属性的示例:
fun <T : Closeable> closeableLazy(initializer: () -> T) =
CloseableLazyVal(initializer)
class CloseableLazyVal<T : Closeable>(
private val initializer: () -> T
) : ReadOnlyProperty<Any?, T> {
private var value: T? = null
override fun get(thisRef: Any?, desc: PropertyMetadata): T {
if (value == null) {
value = initializer()
}
return value
}
fun close() {
value?.close()
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我想用它的方式:
private val stream by closeableLazy { FileOutputStream("/path/to/file") }
fun writeBytes(bytes: ByteArray) {
stream.write(bytes)
}
override …Run Code Online (Sandbox Code Playgroud) 我从来没有见过这个,但是有可能从Oracle和SQl Server有一个SQL调用连接数据吗?
java ×4
oracle ×4
jdbc ×2
kotlin ×2
sql-server ×2
asp-classic ×1
biginteger ×1
cookies ×1
datagrip ×1
delegates ×1
explain ×1
iis ×1
iis-6 ×1
indexing ×1
join ×1
properties ×1
puzzle ×1
return-value ×1
session ×1
sql ×1
sys ×1
sysdba ×1
tablespace ×1
velocity ×1