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
c5895181
Commit
c5895181
authored
Feb 20, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取数平台 bala下载端口
parent
073fea11
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletions
+56
-1
HiveHelper.java
...main/java/com/gic/cloud/data/hook/service/HiveHelper.java
+26
-0
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+6
-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 @
c5895181
...
...
@@ -26,11 +26,14 @@ public class HiveHelper implements ApplicationContextAware {
private
static
DataSource
downloadSource
=
null
;
private
static
DataSource
balaDownloadSource
=
null
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
log
.
debug
(
"setApplicationContext"
,
"准备初始化 Hive 连接池"
);
source
=
(
DataSource
)
applicationContext
.
getBean
(
"hiveSource"
);
downloadSource
=
(
DataSource
)
applicationContext
.
getBean
(
"downloadHiveSource"
);
balaDownloadSource
=
(
DataSource
)
applicationContext
.
getBean
(
"balaDownloadHiveSource"
);
}
/** 获取 Hive 数据源
...
...
@@ -87,4 +90,27 @@ public class HiveHelper implements ApplicationContextAware {
}
// TRY CATCH OVER
}
public
static
Connection
getBalaDownloadHiveConnection
()
{
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
=
balaDownloadSource
.
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 @
c5895181
...
...
@@ -536,7 +536,12 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
0
,
condition
.
getAuthStoreIdList
());
Connection
conn
=
HiveHelper
.
getDownloadHiveConnection
();
Connection
conn
=
null
;
if
(
condition
.
getEnterpriseIds
().
contains
(
"ff8080816dd0385e016ddca436d01fe1"
)){
conn
=
HiveHelper
.
getBalaDownloadHiveConnection
();
}
else
{
conn
=
HiveHelper
.
getDownloadHiveConnection
();
}
if
(
conn
!=
null
)
{
try
{
Statement
stat
=
conn
.
createStatement
();
...
...
gic-cloud-data-hook-service/src/main/resources/data-hook-flat-query-source.xml
View file @
c5895181
...
...
@@ -58,4 +58,27 @@
</property>
</bean>
<bean
class=
"org.apache.commons.dbcp.BasicDataSource"
id=
"balaDownloadHiveSource"
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.baladownload.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