Websphere datasource configuration in IntelliJ
I'm trying to migrate J2EE, very heavy, old school application, from RAD 8.5.5.1 to IntelliJ 2016.1.1. DataSource building using JNDI.
I compiled and configured all components (right for now) except DataSource. In RAD DataSource configured like this, in resource.xml:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<resources.jdbc:JDBCProvider xmi:id="JDBCProvider_1163951110780" name="DB2 DataSource" description="DB2 Universal JDBC Driver Provider" implementationClassName="com.ibm.db2.jcc.DB2ConnectionPoolDataSource">
<classpath>${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar</classpath>
<classpath>${UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.jar</classpath>
<classpath>${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cisuz.jar</classpath>
<nativepath>${DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH}</nativepath>
<factories xmi:type="resources.jdbc:DataSource" xmi:id="DataSource_1163951270521" name="pensionjndi" jndiName="pensionjndi" description="DB2 Universal Driver Datasource" category="" authDataAlias="sec" relationalResourceAdapter="builtin_rra" statementCacheSize="150" datasourceHelperClassname="com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper">
<propertySet xmi:id="J2EEResourcePropertySet_1163951270522">
<resourceProperties xmi:id="J2EEResourceProperty_1163951270523" name="databaseName" type="java.lang.String" value="value" description="This is a required property. This is an actual database name, and its not the locally catalogued database name. The Universal JDBC Driver does not rely on information catalogued in the DB2 database directory." required="true"/>
<resourceProperties xmi:id="J2EEResourceProperty_1163951270524" name="driverType" type="java.lang.Integer" value="4" description="The JDBC connectivity-type of a data source. If you want to use type 4 driver, set the value to 4. If you want to use type 2 driver, set the value to 2. On WAS z/OS, driverType 2 uses RRS and supports 2-phase commit processing." required="true"/>
<resourceProperties xmi:id="J2EEResourceProperty_1163951270525" name="serverName" type="java.lang.String" value="serverName" description="The TCP/IP address or host name for the DRDA server. If custom property driverType is set to 4, this property is required." required="false"/>
<resourceProperties xmi:id="J2EEResourceProperty_1163951270526" name="portNumber" type="java.lang.Integer" value="50000" description="The TCP/IP port number where the DRDA server resides. If custom property driverType is set to 4, this property is required." required="false"/>
...
...
...
<resourceProperties xmi:id="J2EEResourceProperty_1175088739299" name="webSphereDefaultIsolationLevel" type="java.lang.Integer" value="2" description="" required="false"/>
</propertySet>
<connectionPool xmi:id="ConnectionPool_1163951270521" connectionTimeout="15" maxConnections="200" minConnections="5" reapTime="180" unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool"/>
<mapping xmi:id="MappingModule_1163951296456" mappingConfigAlias="DefaultPrincipalMapping" authDataAlias="sec"/>
</factories>
------------------------------------------------------------------------------------------
I tried to define DataSource with same name (pensionjndi) using IntelliJ's "DataSource and Driver" window.
No luck! Application doesn't recognize the DataSourse (but it looking for the RIGHT DS name "pensionjndi")
The question is: What is a right way to configure DataSource for IntelliJ Artifacts? (Using an existing DataSources)
If an additional information required, I'll edit the post.. probably I just missed some important poing.. If you're dealt with migrations (especially if you're migrated your app from IDE RAD), I'll be very thank you for a help! And for any advice from GURU of deployments...
Please sign in to leave a comment.
Hello Alexey,
>I tried to define DataSource with same name (pensionjndi) using IntelliJ's "DataSource and Driver" window.
>No luck! Application doesn't recognize the DataSourse (but it looking for the RIGHT DS name "pensionjndi")
>The question is: What is a right way to configure DataSource for IntelliJ Artifacts? (Using an existing DataSources)
Do you mean that the data source is not found by the application itself? Note that Data Source you define in Database tool window is not related to configuring the data source for your application. IDE Data Source is used to connect to a database and execute queries in IDE.
I'm not sure on which level you are defining the data source for your application: either in WebSphere configuration or in your application files? Perhaps you WebSphere documentation can be of help.
Hello Andrey,
Thank you for quick reply! Really appreciate it!
The followup question: Do you familiar with RAD (IBM eclipse) IDE?
If so, what is the difference between DS defined in resource.xml in RAD and the DS defined in Database tool window? And yes (for your question), how I can see, hibernate.cfg.xml (application) uses an existing DS by name (what is not found) ? Is it IDE's DS or from another source (that I not found yet)
----------------------------------------------------------------------------
<property name="hibernate.connection.datasource">pensionjndi</property>
----------------------------------------------------------------------------
I know if's weird to ask how is works my own application, but ... how I mentioned It's old-heavy-finansional "monter".. With no documentation. With persons who wrote it, retired wile ago ))
(generally I got it, but don't understand what should I do next..)
I'm not familiar with datasources in deep (unfortunately),
Any way I going to go through WebSphere documentation, from the past experience it's often Sisyphus work..
Any advice appreciated!!!
I'm not familiar with RAD, sorry. Based on the hibernate documentation for hibernate.connection.datasource property:
it is a data source JNDI name, which should be available for the the application when it starts. I suppose, you should configure WS server and define data source with this name there. Again, Data Source, you use in Database tool window is not related to your application data source at all.
Thank you!
I'll try figure out how to config WS server.
You helped a lot with the statement about the differences in DataSources.
Andrey, may be you be able to help me in one more thing?
I'm trying to add new DS to project itself by: right click->new->Data Source, but I can't see DB2 driver in this window:
although driver of DB2 looks like exists in Data Source window:
How can I to force "new data source" window to pop DB2 driver?
Please use View | Tool Windows | Database tool window for creating new Data Source. It is recommended way and it has a more options.