Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Component Sharing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gagandeep Singh Bhatia
Component Sharing
Commits
c88c0ade
Commit
c88c0ade
authored
Jun 12, 2026
by
Ajit Deshmukh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handled the special characters case while creating the SavePoint in the ManageSqlConf
parent
2d1a5321
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
159 additions
and
83 deletions
+159
-83
Ajit/Manage SQL Changes APR-26/Java Components/ManageSqlConf.java
...age SQL Changes APR-26/Java Components/ManageSqlConf.java
+159
-83
No files found.
Ajit/Manage SQL Changes APR-26/Java Components/ManageSqlConf.java
View file @
c88c0ade
...
@@ -96,7 +96,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -96,7 +96,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt
=
null
;
pstmt
=
null
;
}
}
if
(
execRights
.
trim
().
length
()==
0
)
{
if
(
execRights
.
trim
().
length
()
==
0
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Blank Execution Rights"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Blank Execution Rights"
);
errString
=
itmdbAccessLocal
.
getErrorString
(
"confirmed"
,
"MSQLBER"
,
""
,
""
,
con
);
errString
=
itmdbAccessLocal
.
getErrorString
(
"confirmed"
,
"MSQLBER"
,
""
,
""
,
con
);
return
errString
;
return
errString
;
...
@@ -209,15 +209,12 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -209,15 +209,12 @@ public class ManageSqlConf extends ActionHandlerEJB {
}
}
}
}
// Added for CLIENT DEV: C transaction can only be confirmed after P (PILOT) is
// Added for CLIENT DEV: C transaction can only be confirmed after P (PILOT) is
// confirmed
// confirmed
if
(
"C"
.
equalsIgnoreCase
(
execRights
))
{
if
(
"C"
.
equalsIgnoreCase
(
execRights
))
{
System
.
out
System
.
out
.
println
(
"This transaction has exec_rights = 'C', checking for dependent 'C' confirmation..."
);
.
println
(
"This transaction has exec_rights = 'C', checking for dependent 'C' confirmation..."
);
String
cCheckSql
=
"SELECT CONFIRMED FROM SQL_CHANGES WHERE EXEC_RIGHTS = 'P' AND tran_id__ref = ?"
;
String
cCheckSql
=
"SELECT CONFIRMED FROM SQL_CHANGES WHERE EXEC_RIGHTS = 'P' AND tran_id__ref = ?"
;
pstmt
=
con
.
prepareStatement
(
cCheckSql
);
pstmt
=
con
.
prepareStatement
(
cCheckSql
);
pstmt
.
setString
(
1
,
tranIdRef
);
pstmt
.
setString
(
1
,
tranIdRef
);
...
@@ -248,7 +245,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -248,7 +245,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
}
}
}
}
// Changes Start -- 13 Nov AJIT (Condition for exec_rights = 'A')
// Changes Start -- 13 Nov AJIT (Condition for exec_rights = 'A')
if
(
"A"
.
equalsIgnoreCase
(
execRights
))
{
if
(
"A"
.
equalsIgnoreCase
(
execRights
))
{
System
.
out
.
println
(
System
.
out
.
println
(
...
@@ -496,7 +492,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -496,7 +492,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
String
dbMainForPilot
=
""
;
String
dbMainForPilot
=
""
;
String
dbClientDev
=
""
;
String
dbClientDev
=
""
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
"execRights ["
+
execRights
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"execRights ["
+
execRights
+
"]"
);
if
(
"Q"
.
equalsIgnoreCase
(
execRights
))
{
if
(
"Q"
.
equalsIgnoreCase
(
execRights
))
{
QcDevEnterprise
=
"APPVISQC"
;
QcDevEnterprise
=
"APPVISQC"
;
...
@@ -515,8 +510,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -515,8 +510,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
requestID
,
requestID
,
userId
,
userId
,
chgTerm
,
chgTerm
,
"Q"
"Q"
);
);
}
}
// For PILOT, look up DB_PILOT from enterprise table using the main
// For PILOT, look up DB_PILOT from enterprise table using the main
...
@@ -571,8 +565,17 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -571,8 +565,17 @@ public class ManageSqlConf extends ActionHandlerEJB {
try
{
try
{
// ENTERPRISE-LEVEL SAVEPOINT
// ENTERPRISE-LEVEL SAVEPOINT
entSavepoint
=
con
.
setSavepoint
(
"SP_"
+
QcDevEnterprise
);
BaseLogger
.
log
(
"1"
,
null
,
null
,
"Before Savepoint"
);
String
sanitizedEnterprise
=
mainEnterprise
.
replaceAll
(
"[^a-zA-Z0-9_]"
,
""
);
BaseLogger
.
log
(
"1"
,
null
,
null
,
"Savepoint Name :: SP_"
+
sanitizedEnterprise
);
entSavepoint
=
con
.
setSavepoint
(
"SP_"
+
sanitizedEnterprise
);
BaseLogger
.
log
(
"1"
,
null
,
null
,
"After Savepoint"
);
if
(
"P"
.
equalsIgnoreCase
(
execRights
))
{
if
(
"P"
.
equalsIgnoreCase
(
execRights
))
{
String
pilotInputSql
=
oracleStatment
;
String
pilotInputSql
=
oracleStatment
;
...
@@ -594,7 +597,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -594,7 +597,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
pilotInputSql
=
injectSchemaPlaceholderSafe
(
pilotInputSql
);
pilotInputSql
=
injectSchemaPlaceholderSafe
(
pilotInputSql
);
}
}
//Made changes by Ajit D. on 10-June for No DDL should get executed in PILOT schema & READ schema
// Made changes by Ajit D. on 10-June for No DDL should get executed in PILOT
// schema & READ schema
// and Only DML will get executed in PILOT schema
// and Only DML will get executed in PILOT schema
// DDL check
// DDL check
boolean
isPilotDDL
=
(
upperSqlP
.
startsWith
(
"CREATE"
)
boolean
isPilotDDL
=
(
upperSqlP
.
startsWith
(
"CREATE"
)
...
@@ -621,7 +625,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -621,7 +625,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
// VERY IMPORTANT
// VERY IMPORTANT
con
.
setAutoCommit
(
false
);
con
.
setAutoCommit
(
false
);
// TO fetch the schemaName and enterprise for live[START]
// TO fetch the schemaName and enterprise for live[START]
Connection
entCon
=
null
;
Connection
entCon
=
null
;
...
@@ -640,7 +643,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -640,7 +643,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
// enterpriseSQL = checkNull( rs.getString("ENTERPRISE") );
// enterpriseSQL = checkNull( rs.getString("ENTERPRISE") );
// schemaListMap.put(schemaName,enterpriseSQL);
// schemaListMap.put(schemaName,enterpriseSQL);
enterpriseArrayList
.
add
(
checkNull
(
rsToFetchEntForP
.
getString
(
"ENTERPRISE"
)));
enterpriseArrayList
.
add
(
checkNull
(
rsToFetchEntForP
.
getString
(
"ENTERPRISE"
)));
}
}
if
(
pstmt
!=
null
)
{
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
.
close
();
...
@@ -661,8 +665,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -661,8 +665,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
// TO fetch the enterprise for live[START]
// TO fetch the enterprise for live[START]
BaseLogger
.
log
(
"1"
,
null
,
null
,
BaseLogger
.
log
(
"1"
,
null
,
null
,
"enterpriseArrayList :: "
+
enterpriseArrayList
);
"enterpriseArrayList :: "
+
enterpriseArrayList
);
...
@@ -696,7 +698,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -696,7 +698,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
try
{
try
{
// ENTERPRISE-LEVEL SAVEPOINT
// ENTERPRISE-LEVEL SAVEPOINT
entSavepointForPilot
=
con
.
setSavepoint
(
"SP_"
+
ent
);
String
sanitizedEnt
=
ent
.
replaceAll
(
"[^a-zA-Z0-9_]"
,
""
);
entSavepointForPilot
=
con
.
setSavepoint
(
"SP_"
+
sanitizedEnt
);
processSqlForEnterprise
(
processSqlForEnterprise
(
con
,
con
,
...
@@ -707,8 +710,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -707,8 +710,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
requestID
,
requestID
,
userId
,
userId
,
chgTerm
,
chgTerm
,
"P"
"P"
);
);
// commit enterprise success
// commit enterprise success
con
.
commit
();
con
.
commit
();
...
@@ -815,7 +817,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -815,7 +817,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
// VERY IMPORTANT
// VERY IMPORTANT
con
.
setAutoCommit
(
false
);
con
.
setAutoCommit
(
false
);
BaseLogger
.
log
(
"1"
,
null
,
null
,
"enterpriseArrayList :: "
+
enterpriseArrayList
);
BaseLogger
.
log
(
"1"
,
null
,
null
,
"enterpriseArrayList :: "
+
enterpriseArrayList
);
String
[]
enterpriseArr
=
null
;
String
[]
enterpriseArr
=
null
;
enterpriseArr
=
enterpriseArrayList
.
toArray
(
new
String
[
0
]);
enterpriseArr
=
enterpriseArrayList
.
toArray
(
new
String
[
0
]);
...
@@ -832,9 +834,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -832,9 +834,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
* enterpriseArr = enterpriseArrayList.toArray(new String[0]);
* enterpriseArr = enterpriseArrayList.toArray(new String[0]);
* }
* }
*/
*/
BaseLogger
.
log
(
"1"
,
null
,
null
,
"enterpriseArr :: "
+
Arrays
.
toString
(
enterpriseArr
)
);
BaseLogger
.
log
(
"1"
,
null
,
null
,
"enterpriseArr :: "
+
Arrays
.
toString
(
enterpriseArr
)
);
for
(
String
enterpriseForExec
:
enterpriseArr
)
{
for
(
String
enterpriseForExec
:
enterpriseArr
)
{
BaseLogger
.
log
(
"1"
,
null
,
null
,
"enterpriseForExec :: "
+
enterpriseForExec
);
BaseLogger
.
log
(
"1"
,
null
,
null
,
"enterpriseForExec ::: "
+
enterpriseForExec
);
String
ent
=
enterpriseForExec
.
trim
();
String
ent
=
enterpriseForExec
.
trim
();
if
(
ent
.
isEmpty
())
{
if
(
ent
.
isEmpty
())
{
...
@@ -845,7 +847,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -845,7 +847,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
try
{
try
{
// ENTERPRISE-LEVEL SAVEPOINT
// ENTERPRISE-LEVEL SAVEPOINT
entSavepoint
=
con
.
setSavepoint
(
"SP_"
+
ent
);
String
sanitizedEnt
=
ent
.
replaceAll
(
"[^a-zA-Z0-9_]"
,
""
);
entSavepoint
=
con
.
setSavepoint
(
"SP_"
+
sanitizedEnt
);
processSqlForEnterprise
(
processSqlForEnterprise
(
con
,
con
,
...
@@ -856,8 +859,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -856,8 +859,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
requestID
,
requestID
,
userId
,
userId
,
chgTerm
,
chgTerm
,
"A"
"A"
);
);
// commit enterprise success
// commit enterprise success
con
.
commit
();
con
.
commit
();
...
@@ -1842,6 +1844,11 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -1842,6 +1844,11 @@ public class ManageSqlConf extends ActionHandlerEJB {
String
chgTerm
,
String
chgTerm
,
String
execRights
)
throws
Exception
{
String
execRights
)
throws
Exception
{
try
{
// Change by Gagan B. on 16-JAN-26
// Change by Gagan B. on 16-JAN-26
// --- FIX: Don't inject placeholders into PL/SQL Bodies ---
// --- FIX: Don't inject placeholders into PL/SQL Bodies ---
String
upperSql
=
checkNull
(
inputSql
).
trim
().
toUpperCase
();
String
upperSql
=
checkNull
(
inputSql
).
trim
().
toUpperCase
();
...
@@ -1883,7 +1890,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -1883,7 +1890,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
dbPilot
=
rs
.
getString
(
"DB_PILOT"
);
dbPilot
=
rs
.
getString
(
"DB_PILOT"
);
}
}
}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"dbMain:: "
+
dbMain
+
" dbRead:: "
+
dbRead
+
" dbPilot:: "
+
dbPilot
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"dbMain:: "
+
dbMain
+
" dbRead:: "
+
dbRead
+
" dbPilot:: "
+
dbPilot
);
/*
/*
* -------------------------------
* -------------------------------
* Get CURRENT_USER
* Get CURRENT_USER
...
@@ -1906,9 +1913,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -1906,9 +1913,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
*/
*/
Map
<
String
,
String
>
schemaRules
=
new
LinkedHashMap
<>();
Map
<
String
,
String
>
schemaRules
=
new
LinkedHashMap
<>();
schemaRules
.
put
(
dbMain
,
"ALL"
);
schemaRules
.
put
(
dbMain
,
"ALL"
);
//schemaRules.put(dbDev, "ALL");
//
schemaRules.put(dbDev, "ALL");
schemaRules
.
put
(
dbRead
,
"SYN"
);
schemaRules
.
put
(
dbRead
,
"SYN"
);
//schemaRules.put(dbPilot, "SYN");
//
schemaRules.put(dbPilot, "SYN");
System
.
out
.
println
(
"execRights ::: "
+
execRights
);
System
.
out
.
println
(
"execRights ::: "
+
execRights
);
if
(
"P"
.
equalsIgnoreCase
(
execRights
)
if
(
"P"
.
equalsIgnoreCase
(
execRights
)
&&
dbPilot
!=
null
&&
dbPilot
!=
null
...
@@ -1923,7 +1930,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -1923,7 +1930,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
System
.
out
.
println
(
"objectName ::: "
+
objectName
);
System
.
out
.
println
(
"objectName ::: "
+
objectName
);
System
.
out
.
println
(
"createObjectType ::: "
+
createObjectType
);
System
.
out
.
println
(
"createObjectType ::: "
+
createObjectType
);
System
.
out
.
println
(
"schemaRules:: "
+
schemaRules
);
System
.
out
.
println
(
"schemaRules:: "
+
schemaRules
);
/*
/*
* -------------------------------
* -------------------------------
* Execute per schema
* Execute per schema
...
@@ -1934,6 +1941,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -1934,6 +1941,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String
schemaName
=
entry
.
getKey
();
String
schemaName
=
entry
.
getKey
();
String
rule
=
entry
.
getValue
();
String
rule
=
entry
.
getValue
();
System
.
out
.
println
(
"schemaName ::: "
+
schemaName
);
System
.
out
.
println
(
"schemaName ::: "
+
schemaName
);
System
.
out
.
println
(
"dbPilot ::: "
+
dbPilot
);
System
.
out
.
println
(
"rule ::: "
+
rule
);
System
.
out
.
println
(
"rule ::: "
+
rule
);
if
(
schemaName
==
null
||
schemaName
.
trim
().
isEmpty
())
if
(
schemaName
==
null
||
schemaName
.
trim
().
isEmpty
())
...
@@ -1976,7 +1984,43 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -1976,7 +1984,43 @@ public class ManageSqlConf extends ActionHandlerEJB {
* Create synonym in CURRENT_USER
* Create synonym in CURRENT_USER
* -----------------------------
* -----------------------------
*/
*/
String
synonymSql
=
"CREATE SYNONYM "
+
schemaName
+
"."
+
objectName
+
String
schemaForPilot
=
schemaName
;
if
(
"P"
.
equalsIgnoreCase
(
execRights
)
&&
schemaName
.
equalsIgnoreCase
(
dbPilot
))
{
ConnDriver
connDriverForPilotSchema
=
new
ConnDriver
();
Connection
connForPilotSchema
=
null
;
connForPilotSchema
=
connDriverForPilotSchema
.
getConnectDB
(
schemaName
);
String
schemaForPilotSql
=
"SELECT USER FROM DUAL"
;
PreparedStatement
schemaForPilotPs
=
connForPilotSchema
.
prepareStatement
(
schemaForPilotSql
);
ResultSet
schemaForPilotRs
=
schemaForPilotPs
.
executeQuery
();
if
(
schemaForPilotRs
.
next
())
{
schemaForPilot
=
checkNull
(
schemaForPilotRs
.
getString
(
1
));
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Pilot actual schema user : ["
+
schemaForPilot
+
"]"
);
}
String
targetSchema
=
schemaName
;
if
(
"P"
.
equalsIgnoreCase
(
execRights
)
&&
schemaName
.
equalsIgnoreCase
(
dbPilot
))
{
targetSchema
=
schemaForPilot
;
}
String
synonymSql
=
"CREATE SYNONYM "
+
targetSchema
+
"."
+
objectName
+
" FOR "
+
dbMain
+
"."
+
objectName
;
" FOR "
+
dbMain
+
"."
+
objectName
;
executeAndLog
(
executeAndLog
(
...
@@ -1999,36 +2043,57 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -1999,36 +2043,57 @@ public class ManageSqlConf extends ActionHandlerEJB {
*/
*/
String
grantSql
=
null
;
String
grantSql
=
null
;
//For Pilot transaction Create Table query grant rights of SELECT, INSERT, UPDATE, DELETE
// For Pilot transaction Create Table query grant rights of SELECT, INSERT,
// UPDATE, DELETE
if
(
"TABLE"
.
equalsIgnoreCase
(
createObjectType
))
{
if
(
"TABLE"
.
equalsIgnoreCase
(
createObjectType
))
{
targetSchema
=
schemaName
;
if
(
"P"
.
equalsIgnoreCase
(
execRights
)
&&
schemaName
.
equalsIgnoreCase
(
dbPilot
))
{
targetSchema
=
schemaForPilot
;
}
if
(
"P"
.
equalsIgnoreCase
(
execRights
)
if
(
"P"
.
equalsIgnoreCase
(
execRights
)
&&
schemaName
.
equalsIgnoreCase
(
dbPilot
))
{
&&
schemaName
.
equalsIgnoreCase
(
dbPilot
))
{
grantSql
=
"GRANT SELECT, INSERT, UPDATE, DELETE ON "
grantSql
=
"GRANT SELECT, INSERT, UPDATE, DELETE ON "
+
dbMain
+
"."
+
objectName
+
dbMain
+
"."
+
objectName
+
" TO "
+
schemaName
;
+
" TO "
+
targetSchema
;
}
else
{
}
else
{
grantSql
=
"GRANT SELECT ON "
grantSql
=
"GRANT SELECT ON "
+
dbMain
+
"."
+
objectName
+
dbMain
+
"."
+
objectName
+
" TO "
+
schemaName
;
+
" TO "
+
targetSchema
;
}
}
}
else
if
(
"VIEW"
.
equalsIgnoreCase
(
createObjectType
)
}
else
if
(
"VIEW"
.
equalsIgnoreCase
(
createObjectType
)
||
"SEQUENCE"
.
equalsIgnoreCase
(
createObjectType
))
{
||
"SEQUENCE"
.
equalsIgnoreCase
(
createObjectType
))
{
grantSql
=
"GRANT SELECT ON "
+
dbMain
+
"."
+
objectName
+
targetSchema
=
(
"P"
.
equalsIgnoreCase
(
execRights
)
" TO "
+
schemaName
;
&&
schemaName
.
equalsIgnoreCase
(
dbPilot
))
?
schemaForPilot
:
schemaName
;
grantSql
=
"GRANT SELECT ON "
+
dbMain
+
"."
+
objectName
+
" TO "
+
targetSchema
;
}
else
if
(
"PROCEDURE"
.
equalsIgnoreCase
(
createObjectType
)
}
else
if
(
"PROCEDURE"
.
equalsIgnoreCase
(
createObjectType
)
||
"FUNCTION"
.
equalsIgnoreCase
(
createObjectType
)
||
"FUNCTION"
.
equalsIgnoreCase
(
createObjectType
)
||
"PACKAGE"
.
equalsIgnoreCase
(
createObjectType
)
||
"PACKAGE"
.
equalsIgnoreCase
(
createObjectType
)
||
"TYPE"
.
equalsIgnoreCase
(
createObjectType
))
{
||
"TYPE"
.
equalsIgnoreCase
(
createObjectType
))
{
grantSql
=
"GRANT EXECUTE ON "
+
dbMain
+
"."
+
objectName
+
targetSchema
=
(
"P"
.
equalsIgnoreCase
(
execRights
)
" TO "
+
schemaName
;
&&
schemaName
.
equalsIgnoreCase
(
dbPilot
))
?
schemaForPilot
:
schemaName
;
grantSql
=
"GRANT EXECUTE ON "
+
dbMain
+
"."
+
objectName
+
" TO "
+
targetSchema
;
}
}
BaseLogger
.
log
(
BaseLogger
.
log
(
"3"
,
"3"
,
...
@@ -2051,8 +2116,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -2051,8 +2116,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
"3"
,
"3"
,
null
,
null
,
null
,
null
,
"dbRead ["
+
dbRead
+
"]"
);
"dbRead [
[
"
+
dbRead
+
"]"
);
if
(
grantSql
!=
null
)
{
if
(
grantSql
!=
null
)
{
executeAndLog
(
executeAndLog
(
schemaName
,
schemaName
,
grantSql
,
grantSql
,
...
@@ -2097,6 +2163,16 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -2097,6 +2163,16 @@ public class ManageSqlConf extends ActionHandlerEJB {
}
}
System
.
out
.
println
(
"Execution completed successfully."
);
System
.
out
.
println
(
"Execution completed successfully."
);
}
catch
(
Exception
e
){
String
error
=
(
e
.
getMessage
()
!=
null
)
?
e
.
getMessage
()
:
e
.
toString
();
System
.
out
.
println
(
"Catch block for processSqlForEnterprise method...."
+
error
);
logSqlExecution
(
tranId
,
enterpriseCode
,
"0"
,
requestID
,
inputSql
,
0
,
"E"
,
userId
,
chgTerm
,
error
,
""
);
}
}
}
// Created a method to execute the SQL in the schemas stored in the Enterprise
// Created a method to execute the SQL in the schemas stored in the Enterprise
...
@@ -2130,24 +2206,24 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -2130,24 +2206,24 @@ public class ManageSqlConf extends ActionHandlerEJB {
String
schemaForPilot
=
""
;
String
schemaForPilot
=
""
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
"executeAndLog inputSql: ["
+
inputSql
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"executeAndLog inputSql: ["
+
inputSql
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"executeAndLog execRights: ["
+
execRights
+
"]"
);
// Changes by Ajit D. on 08-JUNE-26 for Pilot Transaction schema name fetched it
//
Changes by Ajit D. on 08-JUNE-26 for Pilot Transaction schema name fetched it
from USERS
// from USERS
if
(
execRights
.
trim
().
equalsIgnoreCase
(
"P"
))
{
if
(
execRights
.
trim
().
equalsIgnoreCase
(
"P"
))
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"For Pilot schemaName: ["
+
schemaName
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"For Pilot schemaName: ["
+
schemaName
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"executeAndLog inputSql: ["
+
inputSql
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"executeAndLog inputSql: ["
+
inputSql
+
"]"
);
connForPilotSchema
=
connDriverForPilotSchema
.
getConnectDB
(
schemaName
);
connForPilotSchema
=
connDriverForPilotSchema
.
getConnectDB
(
schemaName
);
String
schemaForPilotSql
=
"SELECT USER FROM DUAL"
;
String
schemaForPilotSql
=
"SELECT USER FROM DUAL"
;
PreparedStatement
schemaForPilotPs
=
connForPilotSchema
.
prepareStatement
(
schemaForPilotSql
);
PreparedStatement
schemaForPilotPs
=
connForPilotSchema
.
prepareStatement
(
schemaForPilotSql
);
ResultSet
schemaForPilotRs
=
schemaForPilotPs
.
executeQuery
();
ResultSet
schemaForPilotRs
=
schemaForPilotPs
.
executeQuery
();
while
(
schemaForPilotRs
.
next
())
{
while
(
schemaForPilotRs
.
next
())
{
schemaForPilot
=
checkNull
(
schemaForPilotRs
.
getString
(
"USER"
));
schemaForPilot
=
checkNull
(
schemaForPilotRs
.
getString
(
"USER"
));
}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"schemaForPilot: ["
+
schemaForPilot
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"schemaForPilot: ["
+
schemaForPilot
+
"]"
);
schemaName
=
schemaForPilot
;
schemaName
=
schemaForPilot
;
}
}
String
finalSql
=
applySchema
(
inputSql
,
schemaName
);
String
finalSql
=
applySchema
(
inputSql
,
schemaName
);
...
@@ -2190,8 +2266,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -2190,8 +2266,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
connForExec
=
connForExecRs
.
getString
(
"schema_name"
);
connForExec
=
connForExecRs
.
getString
(
"schema_name"
);
}
}
if
(
execRights
.
trim
().
equalsIgnoreCase
(
"P"
)
||
execRights
.
trim
().
equalsIgnoreCase
(
"C"
))
{
if
(
execRights
.
trim
().
equalsIgnoreCase
(
"P"
)
||
execRights
.
trim
().
equalsIgnoreCase
(
"C"
)){
connForExec
=
schemaName
;
connForExec
=
schemaName
;
}
}
System
.
out
.
println
(
"connForExec:: "
+
connForExec
);
System
.
out
.
println
(
"connForExec:: "
+
connForExec
);
...
@@ -2531,7 +2606,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
...
@@ -2531,7 +2606,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
// TRIGGER: ON table
// TRIGGER: ON table
// FIX IS HERE: Added \\b before ON
// FIX IS HERE: Added \\b before ON
// This prevents matching "actiON", "positiON", "unicON", etc.
// This prevents matching "actiON", "positiON", "unicON", etc.
//Updated the logic to appent the placeholder ( {SCHEMA} ) before the trigger name.
// Updated the logic to appent the placeholder ( {SCHEMA} ) before the trigger
// name.
String
upper
=
s
.
toUpperCase
();
String
upper
=
s
.
toUpperCase
();
if
(
upper
.
startsWith
(
"TRIGGER "
)
if
(
upper
.
startsWith
(
"TRIGGER "
)
...
...
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