Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle数据库适配 #1634

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions headless/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@


<dependencies>
<!-- Oracle-->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${oracle.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.database.nls</groupId>
<artifactId>orai18n</artifactId>
<version>${oracle.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public String functionNameCorrector(String sql) {
public List<String> getTables(ConnectInfo connectionInfo, String schemaName) throws SQLException {
List<String> tablesAndViews = Lists.newArrayList();
DatabaseMetaData metaData = getDatabaseMetaData(connectionInfo);
try (ResultSet resultSet = metaData.getTables(null, null, null,
//TODO oracle查询表 需要根据用户查询 否则查询出的表是所有用户的表
String querySchemaName = (metaData instanceof OracleDatabaseMetaData) ? schemaName : null;
try (ResultSet resultSet = metaData.getTables(null, querySchemaName, null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是postgres数据库的适配器,如果是oracle,需要新增一个OracleAdaptor更合适一点

new String[]{"TABLE", "VIEW"})) {
while (resultSet.next()) {
String name = resultSet.getString("TABLE_NAME");
Expand Down
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<alibaba.druid.version>1.2.3</alibaba.druid.version>
<mysql.connector.java.version>5.1.46</mysql.connector.java.version>
<mybatis.plus.version>3.5.7</mybatis.plus.version>
<oracle.version>21.9.0.0</oracle.version>
<clickhouse.jdbc.version>0.4.6</clickhouse.jdbc.version>
<h2.version>1.4.200</h2.version>
<fastjson.version>2.0.40</fastjson.version>
Expand Down Expand Up @@ -79,6 +80,17 @@

<dependencyManagement>
<dependencies>
<!-- Oracle-->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${oracle.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.database.nls</groupId>
<artifactId>orai18n</artifactId>
<version>${oracle.version}</version>
</dependency>
<!--pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
Expand Down
Loading