-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
26 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- Copy it to tomcat/conf context.xml --> | ||
<!-- Copy jar of driverClass/JNDIFactory to tomcat lib --> | ||
<!-- If you want to change db pool factory, add this factory="com.zaxxer.hikari.HikariJNDIFactory" --> | ||
<!-- How to use a JNDI data source with the Crystal Reports Java SDK on Tomcat https://userapps.support.sap.com/sap/support/knowledge/en/1343290 --> | ||
<Resource name="jdbc/SageDB" auth="Container" | ||
type="javax.sql.DataSource" | ||
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" | ||
url="jdbc:sqlserver://server\instance;DatabaseName=dbname;trustServerCertificate=true" | ||
username="user" | ||
password="password" | ||
maxTotal="4" | ||
maxIdle="2" | ||
initialSize="1" | ||
removeAbandonedOnBorrow="true" | ||
removeAbandonedOnMaintenance="true" | ||
removeAbandonedTimeout="60" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @Author : Robert Huang<[email protected]> * | ||
* @CreatedDate : 2023-03-07 00:03:27 * | ||
* @LastEditors : Robert Huang<[email protected]> * | ||
* @LastEditDate : 2023-10-19 14:47:59 * | ||
* @LastEditDate : 2023-10-19 16:38:07 * | ||
* @FilePath : src/main/java/com/da/crystal/report/CRJavaHelper.java * | ||
* @CopyRight : Dedienne Aerospace China ZhuHai * | ||
*********************************************************************************************************************/ | ||
|
@@ -91,6 +91,7 @@ public static void logonDataSource(ReportClientDocument clientDoc, String userna | |
* @param password The DB logon password | ||
* @param connectionURL The connection URL | ||
* @param driverName The driver Name | ||
* @param jndiName The JNDI Name | ||
* @param fileName The file name | ||
* @param filePath The file path | ||
* // How to use a JNDI data source with the Crystal Reports Java SDK on Tomcat https://userapps.support.sap.com/sap/support/knowledge/en/1343290 | ||
|
@@ -103,7 +104,7 @@ public static void changeDataSource( | |
String password, | ||
String connectionURL, | ||
String driverName, | ||
String JNDI, | ||
String jndiName, | ||
String fileName, | ||
String filePath | ||
) { | ||
|
@@ -116,8 +117,8 @@ public static void changeDataSource( | |
// JNDI name for Crystal Report must start with 'jdbc/' | ||
// https://userapps.support.sap.com/sap/support/knowledge/en/1343290 | ||
|
||
if (!JNDI.isBlank()) { | ||
newPropertyBag.put("Connection Name (Optional)", JNDI); | ||
if (!jndiName.isBlank()) { | ||
newPropertyBag.put("Connection Name (Optional)", jndiName); | ||
} else { | ||
newPropertyBag.put("Server Type", "JDBC (JNDI)"); | ||
newPropertyBag.put("Use JDBC", "true"); | ||
|
@@ -130,7 +131,7 @@ public static void changeDataSource( | |
// If same jdbc info, just do login | ||
IConnectionInfo oldConnectionInfo = clientDoc.getDatabaseController().getConnectionInfos(null).get(0); | ||
PropertyBag oldPropertyBag = oldConnectionInfo.getAttributes(); | ||
if (JNDI.isBlank() && | ||
if (jndiName.isBlank() && | ||
oldPropertyBag.getStringValue("Server Type").equals("JDBC (JNDI)") && | ||
oldPropertyBag.getStringValue("Connection URL").equals(connectionURL) && | ||
oldPropertyBag.getStringValue("Database Class Name").equals(driverName) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @Author : Robert Huang<[email protected]> * | ||
* @CreatedDate : 2023-03-06 21:22:42 * | ||
* @LastEditors : Robert Huang<[email protected]> * | ||
* @LastEditDate : 2023-10-19 14:50:30 * | ||
* @LastEditDate : 2023-10-19 16:46:17 * | ||
* @FilePath : src/main/java/com/da/crystal/report/ReportController.java * | ||
* @CopyRight : Dedienne Aerospace China ZhuHai * | ||
*********************************************************************************************************************/ | ||
|
@@ -47,8 +47,8 @@ public class ReportController { | |
@Value("${rpt.datasource.password}") | ||
private String password; | ||
|
||
@Value("${rpt.datasource.JNDI}") | ||
private String JNDI; | ||
@Value("${rpt.datasource.jndiName}") | ||
private String jndiName; | ||
|
||
@GetMapping("/Report/*/*") | ||
public void handReportRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException { | ||
|
@@ -135,7 +135,7 @@ public void handReportRequest(HttpServletRequest req, HttpServletResponse resp) | |
password, | ||
url, | ||
driverClassName, | ||
JNDI, | ||
jndiName, | ||
report + ".rpt", | ||
reportsPath | ||
); | ||
|