Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d3bb6c84
提交
d3bb6c84
authored
2月 10, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Detect unsupported URLs for the driver in JdbcUtils.getConnection()
上级
1fc1d43e
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
32 行增加
和
22 行删除
+32
-22
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
JdbcUtils.java
h2/src/main/org/h2/util/JdbcUtils.java
+20
-15
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+9
-6
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
d3bb6c84
...
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
Issue #1730: console can no longer connect to psql dbs in v1.4.197 (works in v1.4.196)
</li>
<li>
Issue #1590: Error on executing "DELETE FROM table1 WHERE ID = ?; DELETE FROM table2 WHERE ID = ?;"
</li>
<li>
Issue #1727: Support ISODOW as identifier for the extract function additional to ISO_DAY_OF_WEEK
...
...
h2/src/main/org/h2/util/JdbcUtils.java
浏览文件 @
d3bb6c84
...
...
@@ -288,17 +288,24 @@ public class JdbcUtils {
JdbcUtils
.
load
(
url
);
}
else
{
Class
<?>
d
=
loadUserClass
(
driver
);
if
(
java
.
sql
.
Driver
.
class
.
isAssignableFrom
(
d
))
{
try
{
if
(
java
.
sql
.
Driver
.
class
.
isAssignableFrom
(
d
))
{
Driver
driverInstance
=
(
Driver
)
d
.
getDeclaredConstructor
().
newInstance
();
return
driverInstance
.
connect
(
url
,
prop
);
/*fix issue #695 with drivers with the same
jdbc subprotocol in classpath of jdbc drivers (as example redshift and postgresql drivers)*/
}
catch
(
Exception
e
)
{
throw
DbException
.
toSQLException
(
e
);
/*
* fix issue #695 with drivers with the same jdbc
* subprotocol in classpath of jdbc drivers (as example
* redshift and postgresql drivers)
*/
Connection
connection
=
driverInstance
.
connect
(
url
,
prop
);
if
(
connection
!=
null
)
{
return
connection
;
}
/*
* URL is not valid for the specified driver, fallback to
* default.
*/
}
else
if
(
javax
.
naming
.
Context
.
class
.
isAssignableFrom
(
d
))
{
// JNDI context
try
{
Context
context
=
(
Context
)
d
.
getDeclaredConstructor
().
newInstance
();
DataSource
ds
=
(
DataSource
)
context
.
lookup
(
url
);
String
user
=
prop
.
getProperty
(
"user"
);
...
...
@@ -307,13 +314,11 @@ public class JdbcUtils {
return
ds
.
getConnection
();
}
return
ds
.
getConnection
(
user
,
password
);
}
}
catch
(
Exception
e
)
{
throw
DbException
.
toSQLException
(
e
);
}
}
else
{
// don't know, but maybe it loaded a JDBC Driver
return
DriverManager
.
getConnection
(
url
,
prop
);
}
}
return
DriverManager
.
getConnection
(
url
,
prop
);
}
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
d3bb6c84
...
...
@@ -510,12 +510,15 @@ public class TestTools extends TestDb {
}
private
void
testJdbcDriverUtils
()
{
assertEquals
(
"org.h2.Driver"
,
JdbcUtils
.
getDriver
(
"jdbc:h2:~/test"
));
assertEquals
(
"org.postgresql.Driver"
,
JdbcUtils
.
getDriver
(
"jdbc:postgresql:test"
));
assertEquals
(
null
,
JdbcUtils
.
getDriver
(
"jdbc:unknown:test"
));
assertEquals
(
"org.h2.Driver"
,
JdbcUtils
.
getDriver
(
"jdbc:h2:~/test"
));
assertEquals
(
"org.postgresql.Driver"
,
JdbcUtils
.
getDriver
(
"jdbc:postgresql:test"
));
assertEquals
(
null
,
JdbcUtils
.
getDriver
(
"jdbc:unknown:test"
));
try
{
JdbcUtils
.
getConnection
(
"org.h2.Driver"
,
"jdbc:h2x:test"
,
"sa"
,
""
);
fail
(
"Expected SQLException: No suitable driver found"
);
}
catch
(
SQLException
e
)
{
// OK
}
}
private
void
testWrongServer
()
throws
Exception
{
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
d3bb6c84
...
...
@@ -807,4 +807,4 @@ analyst occupation distributive josaph aor engineer sajeewa isuru randil kevin d
corrupts splitted disruption unintentional octets preconditions predicates subq objectweb insn opcodes
preserves masking holder unboxing avert iae transformed subtle reevaluate exclusions subclause ftbl rgr
presorted inclusion contexts aax mwd percentile cont interpolate mwa hypothetical regproc childed listagg foreground
isodow isoyear
isodow isoyear
psql
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论