Hi,
Juste a mini-post concerning the configuation of DATASOURCE on Documentum server.
The DATASOURCE (DS) are configurable:
- in windows via the ODBC Data Source Administrator https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/open-the-odbc-data-source-administrator
- in JAVA METHOD SERVER (Jboss) via the file D:\Documentum\jboss7.1.1\server\DctmServer_MethodServer\configuration\standalone.xml
Here, the example for the DS “java:/MY_ARCHIVE_DS” :
01 | <? xml version = '1.0' encoding = 'UTF-8' ?> |
02 | < server xmlns = "urn:jboss:domain:1.2" > |
03 | < profile > |
04 | < subsystem xmlns = "urn:jboss:domain:datasources:1.0" > |
05 |
06 | < datasources > |
07 |
08 | < datasource jndi-name = "java:/MY_ARCHIVE_DS" pool-name = "MY_ARCHIVE_DS" enabled = "true" use-java-context = "true" > |
09 | < connection-url >jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MYDBSERVER123)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=MYARCHIVE)))</ connection-url > |
10 | < driver >oracle.jdbc</ driver > |
11 | < pool > |
12 | < min-pool-size >5</ min-pool-size > |
13 | < max-pool-size >100</ max-pool-size > |
14 | </ pool > |
15 | < security > |
16 | < user-name >MY_APP_USER</ user-name > |
17 | < password >WD{HUO/dfdfdsfdsfh]-DUHi</ password > |
18 | </ security > |
19 | < validation > |
20 | < exception-sorter class-name = "org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter" /> |
21 | </ validation > |
22 | </ datasource > |
23 | < drivers > |
24 | < driver name = "h2" module = "com.h2database.h2" > |
25 | < xa-datasource-class >org.h2.jdbcx.JdbcDataSource</ xa-datasource-class > |
26 | </ driver > |
27 | < driver name = "oracle.jdbc" module = "oracle.jdbc" > |
28 | < xa-datasource-class >oracle.jdbc.xa.client.OracleXADataSource</ xa-datasource-class > |
29 | </ driver > |
30 | < driver name = "sqljdbc" module = "com.microsoft.sqlserver" > |
31 | < driver-class >com.microsoft.sqlserver.jdbc.SQLServerDriver</ driver-class > |
32 | </ driver > |
33 | </ drivers > |
34 | </ datasources > |
35 | </ subsystem > |
36 | </ profile > |
37 |
38 | < interfaces > |
39 |
40 | </ interfaces > |
41 |
42 | < socket-binding-group name = "standard-sockets" default-interface = "public" port-offset = "${jboss.socket.binding.port-offset:0}" > |
43 |
44 | </ socket-binding-group > |
45 | </ server > |
The use of this DS in the JOB/JAVA code could be:
01 | private static final String DS = "MY_ARCHIVE_DS" ; |
02 | private static final String JNDI_PREFIX[] = { "java:/" , "java:" , "jdbc/" }; |
03 |
04 | //... |
05 | InitialContext ic = new InitialContext(); |
06 | for ( int i = 0 ; i < JNDI_PREFIX.length && dataSource == null ; i++) { |
07 | try { |
08 | dataSource = (DataSource) ic.lookup(JNDI_PREFIX[i] + DS); |
09 | } catch (NamingException e) { |
10 | } |
11 | } |
12 | if (dataSource == null ) { |
13 | throw new Exception( "Unable to find datasource " + DS); |
14 | } |
15 | //... |
16 |
17 | Connection connection = dataSource.getConnection(); |
18 | try { |
19 | connection.setAutoCommit( false ); |
20 |
21 | PreparedStatement statement = connection.prepareStatement(MessageFormat.format(sql.toString(), StringUtils.upperCase(StringUtils.trimToEmpty(table)), year.format(coll.getTime( "time_stamp" ).getDate()))); |
22 |
23 | //... Save the original data in a BLOB field in ARCHIVE database |
24 | Blob blob = connection.createBlob(); |
25 |
26 | //... |
27 | statement.executeUpdate(); |
28 |
29 | //... |
30 | blob.free(); |
31 |
32 | //... |
33 | statement.close(); |
34 |
35 | //... |
36 |
37 | } finally { |
38 |
39 | if (connection!= null ){ |
40 |
41 | if (commit) { |
42 | connection.commit(); |
43 | println( "SqlConnection transaction commited !" ); |
44 | } else { |
45 | connection.rollback(); |
46 | println( "SqlConnection transaction rollbacked !" ); |
47 | } |
48 | connection.close(); |
49 | } |
50 | } |
That’s all!!!
Huseyin OZVEREN