Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9c942768
提交
9c942768
authored
1月 16, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
f15cb116
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
85 行增加
和
53 行删除
+85
-53
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+16
-8
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+16
-10
JdbcXid.java
h2/src/main/org/h2/jdbcx/JdbcXid.java
+7
-1
SecureSocketFactory.java
h2/src/main/org/h2/security/SecureSocketFactory.java
+42
-31
OdbcServer.java
h2/src/main/org/h2/server/OdbcServer.java
+1
-1
OdbcServerThread.java
h2/src/main/org/h2/server/OdbcServerThread.java
+2
-1
TcpServer.java
h2/src/main/org/h2/server/TcpServer.java
+1
-1
没有找到文件。
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
9c942768
...
@@ -14,11 +14,13 @@ import javax.naming.NamingException;
...
@@ -14,11 +14,13 @@ import javax.naming.NamingException;
import
javax.naming.Reference
;
import
javax.naming.Reference
;
import
javax.naming.Referenceable
;
import
javax.naming.Referenceable
;
import
javax.naming.StringRefAddr
;
import
javax.naming.StringRefAddr
;
//#ifdef JDK14
import
javax.sql.ConnectionPoolDataSource
;
import
javax.sql.ConnectionPoolDataSource
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
javax.sql.PooledConnection
;
import
javax.sql.PooledConnection
;
import
javax.sql.XAConnection
;
import
javax.sql.XAConnection
;
import
javax.sql.XADataSource
;
import
javax.sql.XADataSource
;
//#endif
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
...
@@ -34,16 +36,20 @@ import org.h2.message.Message;
...
@@ -34,16 +36,20 @@ import org.h2.message.Message;
*
*
* @author Tom
* @author Tom
*/
*/
public
class
JdbcDataSource
extends
TraceObject
implements
XADataSource
,
DataSource
,
ConnectionPoolDataSource
,
Serializable
,
Referenceable
{
public
class
JdbcDataSource
extends
TraceObject
implements
//#ifdef JDK14
XADataSource
,
DataSource
,
ConnectionPoolDataSource
,
//#endif
Serializable
,
Referenceable
{
private
static
final
long
serialVersionUID
=
1288136338451857771L
;
private
static
final
long
serialVersionUID
=
1288136338451857771L
;
private
transient
JdbcDataSourceFactory
factory
=
new
JdbcDataSourceFactory
();
private
transient
JdbcDataSourceFactory
factory
=
new
JdbcDataSourceFactory
();
private
transient
PrintWriter
logWriter
;
private
transient
PrintWriter
logWriter
;
private
int
timeout
;
private
int
timeout
;
private
String
user
;
private
String
user
=
""
;
private
String
password
;
private
String
password
=
""
;
private
String
url
;
private
String
url
=
""
;
public
JdbcDataSource
()
{
public
JdbcDataSource
()
{
int
id
=
getNextId
(
TraceObject
.
DATASOURCE
);
int
id
=
getNextId
(
TraceObject
.
DATASOURCE
);
...
@@ -129,6 +135,7 @@ public class JdbcDataSource extends TraceObject implements XADataSource, DataSou
...
@@ -129,6 +135,7 @@ public class JdbcDataSource extends TraceObject implements XADataSource, DataSou
return
ref
;
return
ref
;
}
}
//#ifdef JDK14
public
XAConnection
getXAConnection
()
throws
SQLException
{
public
XAConnection
getXAConnection
()
throws
SQLException
{
debugCodeCall
(
"getXAConnection"
);
debugCodeCall
(
"getXAConnection"
);
int
id
=
getNextId
(
XA_DATASOURCE
);
int
id
=
getNextId
(
XA_DATASOURCE
);
...
@@ -150,21 +157,22 @@ public class JdbcDataSource extends TraceObject implements XADataSource, DataSou
...
@@ -150,21 +157,22 @@ public class JdbcDataSource extends TraceObject implements XADataSource, DataSou
debugCode
(
"getPooledConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
debugCode
(
"getPooledConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
return
getXAConnection
(
user
,
password
);
return
getXAConnection
(
user
,
password
);
}
}
//#endif
//#ifdef JDK16
//#ifdef JDK16
/*
/*
public <T> T unwrap(Class<T> iface) throws SQLException {
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException();
}
}
*/
*/
//#endif
//#endif
//#ifdef JDK16
//#ifdef JDK16
/*
/*
public boolean isWrapperFor(Class<?> iface) throws SQLException {
public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException();
}
}
*/
*/
//#endif
//#endif
}
}
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
9c942768
...
@@ -4,24 +4,25 @@
...
@@ -4,24 +4,25 @@
*/
*/
package
org
.
h2
.
jdbcx
;
package
org
.
h2
.
jdbcx
;
//#ifdef JDK14
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Properties
;
import
java.util.Properties
;
import
javax.sql.ConnectionEvent
;
import
javax.sql.ConnectionEvent
;
import
javax.sql.ConnectionEventListener
;
import
javax.sql.ConnectionEventListener
;
import
javax.sql.XAConnection
;
import
javax.sql.XAConnection
;
import
javax.transaction.xa.XAException
;
import
javax.transaction.xa.XAException
;
import
javax.transaction.xa.XAResource
;
import
javax.transaction.xa.XAResource
;
import
javax.transaction.xa.Xid
;
import
javax.transaction.xa.Xid
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.TraceObject
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.jdbc.JdbcConnection
;
//#endif
import
org.h2.message.TraceObject
;
//#ifdef JDK16
//#ifdef JDK16
/*
/*
...
@@ -29,8 +30,13 @@ import javax.sql.StatementEventListener;
...
@@ -29,8 +30,13 @@ import javax.sql.StatementEventListener;
*/
*/
//#endif
//#endif
public
class
JdbcXAConnection
extends
TraceObject
implements
XAConnection
,
JdbcConnectionListener
,
XAResource
{
public
class
JdbcXAConnection
extends
TraceObject
//#ifdef JDK14
implements
XAConnection
,
XAResource
,
JdbcConnectionListener
//#endif
{
//#ifdef JDK14
private
JdbcDataSourceFactory
factory
;
private
JdbcDataSourceFactory
factory
;
private
String
url
,
user
,
password
;
private
String
url
,
user
,
password
;
private
JdbcConnection
conn
;
private
JdbcConnection
conn
;
...
@@ -272,22 +278,22 @@ public class JdbcXAConnection extends TraceObject implements XAConnection, JdbcC
...
@@ -272,22 +278,22 @@ public class JdbcXAConnection extends TraceObject implements XAConnection, JdbcC
}
}
getTrace
().
debug
(
"committed"
);
getTrace
().
debug
(
"committed"
);
}
}
//#endif
//#ifdef JDK16
//#ifdef JDK16
/*
/*
public void addStatementEventListener(StatementEventListener listener) {
public void addStatementEventListener(StatementEventListener listener) {
throw new UnsupportedOperationException();
throw new UnsupportedOperationException();
}
}
*/
*/
//#endif
//#endif
//#ifdef JDK16
//#ifdef JDK16
/*
/*
public void removeStatementEventListener(StatementEventListener listener) {
public void removeStatementEventListener(StatementEventListener listener) {
throw new UnsupportedOperationException();
throw new UnsupportedOperationException();
}
}
*/
*/
//#endif
//#endif
}
}
h2/src/main/org/h2/jdbcx/JdbcXid.java
浏览文件 @
9c942768
...
@@ -7,13 +7,19 @@ package org.h2.jdbcx;
...
@@ -7,13 +7,19 @@ package org.h2.jdbcx;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
//#ifdef JDK14
import
javax.transaction.xa.Xid
;
import
javax.transaction.xa.Xid
;
//#endif
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.ByteUtils
;
public
class
JdbcXid
extends
TraceObject
implements
Xid
{
public
class
JdbcXid
extends
TraceObject
//#ifdef JDK14
implements
Xid
//#endif
{
private
static
final
String
PREFIX
=
"XID"
;
private
static
final
String
PREFIX
=
"XID"
;
...
...
h2/src/main/org/h2/security/SecureSocketFactory.java
浏览文件 @
9c942768
...
@@ -4,15 +4,18 @@
...
@@ -4,15 +4,18 @@
*/
*/
package
org
.
h2
.
security
;
package
org
.
h2
.
security
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.net.ServerSocket
;
import
java.net.Socket
;
import
java.sql.SQLException
;
//#ifdef JDK14
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.net.ServerSocket
;
import
java.net.Socket
;
import
java.security.Key
;
import
java.security.Key
;
import
java.security.KeyFactory
;
import
java.security.KeyFactory
;
import
java.security.KeyStore
;
import
java.security.KeyStore
;
...
@@ -24,20 +27,18 @@ import java.security.cert.Certificate;
...
@@ -24,20 +27,18 @@ import java.security.cert.Certificate;
import
java.security.cert.CertificateEncodingException
;
import
java.security.cert.CertificateEncodingException
;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.CertificateFactory
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.sql.SQLException
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.Properties
;
import
java.util.Properties
;
import
javax.net.ServerSocketFactory
;
import
javax.net.ServerSocketFactory
;
import
javax.net.ssl.SSLServerSocket
;
import
javax.net.ssl.SSLServerSocket
;
import
javax.net.ssl.SSLServerSocketFactory
;
import
javax.net.ssl.SSLServerSocketFactory
;
import
javax.net.ssl.SSLSocket
;
import
javax.net.ssl.SSLSocket
;
import
javax.net.ssl.SSLSocketFactory
;
import
javax.net.ssl.SSLSocketFactory
;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.FileUtils
;
import
org.h2.util.FileUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
//#endif
/**
/**
*
*
...
@@ -70,6 +71,39 @@ public class SecureSocketFactory {
...
@@ -70,6 +71,39 @@ public class SecureSocketFactory {
return
factory
;
return
factory
;
}
}
public
Socket
createSocket
(
InetAddress
address
,
int
port
)
throws
SQLException
,
IOException
{
Socket
socket
=
null
;
//#ifdef JDK14
setKeystore
();
SSLSocketFactory
f
=
(
SSLSocketFactory
)
SSLSocketFactory
.
getDefault
();
SSLSocket
secureSocket
=
(
SSLSocket
)
f
.
createSocket
(
address
,
port
);
if
(
ENABLE_ANONYMOUS_SSL
)
{
String
[]
list
=
secureSocket
.
getEnabledCipherSuites
();
list
=
addAnonymous
(
list
);
secureSocket
.
setEnabledCipherSuites
(
list
);
}
socket
=
secureSocket
;
//#endif
return
socket
;
}
public
ServerSocket
createServerSocket
(
int
port
)
throws
IOException
,
SQLException
{
ServerSocket
socket
=
null
;
//#ifdef JDK14
setKeystore
();
ServerSocketFactory
f
=
SSLServerSocketFactory
.
getDefault
();
SSLServerSocket
secureSocket
=
(
SSLServerSocket
)
f
.
createServerSocket
(
port
);
if
(
ENABLE_ANONYMOUS_SSL
)
{
String
[]
list
=
secureSocket
.
getEnabledCipherSuites
();
list
=
addAnonymous
(
list
);
secureSocket
.
setEnabledCipherSuites
(
list
);
}
socket
=
secureSocket
;
//#endif
return
socket
;
}
//#ifdef JDK14
private
static
byte
[]
getBytes
(
String
hex
)
throws
SQLException
{
private
static
byte
[]
getBytes
(
String
hex
)
throws
SQLException
{
return
ByteUtils
.
convertStringToBytes
(
hex
);
return
ByteUtils
.
convertStringToBytes
(
hex
);
}
}
...
@@ -178,18 +212,6 @@ public class SecureSocketFactory {
...
@@ -178,18 +212,6 @@ public class SecureSocketFactory {
}
}
}
}
public
ServerSocket
createServerSocket
(
int
port
)
throws
IOException
,
SQLException
{
setKeystore
();
ServerSocketFactory
f
=
SSLServerSocketFactory
.
getDefault
();
SSLServerSocket
socket
=
(
SSLServerSocket
)
f
.
createServerSocket
(
port
);
if
(
ENABLE_ANONYMOUS_SSL
)
{
String
[]
list
=
socket
.
getEnabledCipherSuites
();
list
=
addAnonymous
(
list
);
socket
.
setEnabledCipherSuites
(
list
);
}
return
socket
;
}
private
String
[]
addAnonymous
(
String
[]
list
)
{
private
String
[]
addAnonymous
(
String
[]
list
)
{
String
[]
newList
=
new
String
[
list
.
length
+
1
];
String
[]
newList
=
new
String
[
list
.
length
+
1
];
System
.
arraycopy
(
list
,
0
,
newList
,
1
,
list
.
length
);
System
.
arraycopy
(
list
,
0
,
newList
,
1
,
list
.
length
);
...
@@ -197,18 +219,6 @@ public class SecureSocketFactory {
...
@@ -197,18 +219,6 @@ public class SecureSocketFactory {
return
newList
;
return
newList
;
}
}
public
Socket
createSocket
(
InetAddress
address
,
int
port
)
throws
SQLException
,
IOException
{
setKeystore
();
SSLSocketFactory
f
=
(
SSLSocketFactory
)
SSLSocketFactory
.
getDefault
();
SSLSocket
socket
=
(
SSLSocket
)
f
.
createSocket
(
address
,
port
);
if
(
ENABLE_ANONYMOUS_SSL
)
{
String
[]
list
=
socket
.
getEnabledCipherSuites
();
list
=
addAnonymous
(
list
);
socket
.
setEnabledCipherSuites
(
list
);
}
return
socket
;
}
// private void listCipherSuites(SSLServerSocketFactory f) {
// private void listCipherSuites(SSLServerSocketFactory f) {
// String[] def = f.getDefaultCipherSuites();
// String[] def = f.getDefaultCipherSuites();
// for(int i=0; i<def.length; i++) {
// for(int i=0; i<def.length; i++) {
...
@@ -219,5 +229,6 @@ public class SecureSocketFactory {
...
@@ -219,5 +229,6 @@ public class SecureSocketFactory {
// System.out.println("supported = " + sup[i]);
// System.out.println("supported = " + sup[i]);
// }
// }
// }
// }
//#endif
}
}
h2/src/main/org/h2/server/OdbcServer.java
浏览文件 @
9c942768
...
@@ -80,7 +80,7 @@ public class OdbcServer implements Service {
...
@@ -80,7 +80,7 @@ public class OdbcServer implements Service {
if
(
allowOthers
)
{
if
(
allowOthers
)
{
return
true
;
return
true
;
}
}
return
socket
.
getInetAddress
().
isLoopbackAddress
(
);
return
NetUtils
.
isLoopbackAddress
(
socket
);
}
}
public
void
start
()
throws
SQLException
{
public
void
start
()
throws
SQLException
{
...
...
h2/src/main/org/h2/server/OdbcServerThread.java
浏览文件 @
9c942768
...
@@ -27,6 +27,7 @@ import org.h2.engine.ConnectionInfo;
...
@@ -27,6 +27,7 @@ import org.h2.engine.ConnectionInfo;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.DataType
;
/**
/**
* @author Thomas
* @author Thomas
...
@@ -645,7 +646,7 @@ public class OdbcServerThread implements Runnable {
...
@@ -645,7 +646,7 @@ public class OdbcServerThread implements Runnable {
return
sqlType
;
return
sqlType
;
case
Types
.
TINYINT
:
case
Types
.
TINYINT
:
case
Types
.
BIT
:
case
Types
.
BIT
:
case
Types
.
BOOLEAN
:
case
DataType
.
TYPE_
BOOLEAN
:
return
Types
.
INTEGER
;
return
Types
.
INTEGER
;
case
Types
.
BIGINT
:
case
Types
.
BIGINT
:
case
Types
.
BINARY
:
case
Types
.
BINARY
:
...
...
h2/src/main/org/h2/server/TcpServer.java
浏览文件 @
9c942768
...
@@ -108,7 +108,7 @@ public class TcpServer implements Service {
...
@@ -108,7 +108,7 @@ public class TcpServer implements Service {
if
(
allowOthers
)
{
if
(
allowOthers
)
{
return
true
;
return
true
;
}
}
return
socket
.
getInetAddress
().
isLoopbackAddress
(
);
return
NetUtils
.
isLoopbackAddress
(
socket
);
}
}
public
void
start
()
throws
SQLException
{
public
void
start
()
throws
SQLException
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论