Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-cloud
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-hook
gic-cloud
Commits
abffde53
Commit
abffde53
authored
Jun 11, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取数平台权限
parent
1b03e693
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletions
+49
-1
HiveHelper.java
...main/java/com/gic/cloud/data/hook/service/HiveHelper.java
+24
-0
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+1
-1
data-hook-flat-query-source.xml
...ervice/src/main/resources/data-hook-flat-query-source.xml
+24
-0
No files found.
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/HiveHelper.java
View file @
abffde53
...
...
@@ -24,10 +24,13 @@ public class HiveHelper implements ApplicationContextAware {
/** 内置数据源 */
private
static
DataSource
source
=
null
;
private
static
DataSource
downloadSource
=
null
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
log
.
debug
(
"setApplicationContext"
,
"准备初始化 Hive 连接池"
);
source
=
(
DataSource
)
applicationContext
.
getBean
(
"hiveSource"
);
downloadSource
=
(
DataSource
)
applicationContext
.
getBean
(
"downloadHiveSource"
);
}
/** 获取 Hive 数据源
...
...
@@ -62,5 +65,26 @@ public class HiveHelper implements ApplicationContextAware {
}
// TRY CATCH OVER
}
public
static
Connection
getDownloadHiveConnection
()
{
Connection
conn
=
null
;
try
{
// String url = "jdbc:hive2://115.159.205.44:10015/data_test";
// //String url = "jdbc:hive2://10.0.0.3:10015/data_test";
// Class.forName("org.apache.hive.jdbc.HiveDriver");
// conn = DriverManager.getConnection(url, "hadoop", "");
conn
=
downloadSource
.
getConnection
();
return
conn
;
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
if
(
conn
!=
null
)
{
try
{
conn
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
return
null
;
}
// TRY CATCH OVER
}
}
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FlatQueryResultServiceImpl.java
View file @
abffde53
...
...
@@ -503,7 +503,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
0
,
condition
.
getAuthStoreIdList
());
Connection
conn
=
HiveHelper
.
getHiveConnection
();
Connection
conn
=
HiveHelper
.
get
Download
HiveConnection
();
if
(
conn
!=
null
)
{
try
{
Statement
stat
=
conn
.
createStatement
();
...
...
gic-cloud-data-hook-service/src/main/resources/data-hook-flat-query-source.xml
View file @
abffde53
...
...
@@ -35,4 +35,27 @@
</property>
</bean>
<bean
class=
"org.apache.commons.dbcp.BasicDataSource"
id=
"downloadHiveSource"
destroy-method=
"close"
>
<property
name=
"driverClassName"
value=
"org.apache.hive.jdbc.HiveDriver"
/>
<!--<property name="url" value="jdbc:hive2://115.159.205.44:10015/data_test" />-->
<property
name=
"url"
value=
"${hive.download.url}"
/>
<property
name=
"username"
value=
"${hive.username}"
/>
<property
name=
"password"
value=
""
/>
<property
name=
"maxActive"
>
<value>
20
</value>
</property>
<property
name=
"maxIdle"
>
<value>
5
</value>
</property>
<property
name=
"minIdle"
>
<value>
1
</value>
</property>
<property
name=
"testWhileIdle"
>
<value>
true
</value>
</property>
<property
name=
"maxWait"
>
<value>
120000
</value>
</property>
</bean>
</beans>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment