Websphere datasource configuration in IntelliJ - intellij-idea

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
DS IntelliJ Screen
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..
I didn't found any example, or guide, for DataSource config for websphere.
Please HELP!?

The problem is solved by defining data source in Websphere Application Console. WAS console | Resorces | Data Sources
See the topic of IBM "Configuring a data source using the administrative console"
Here is discussion about the problem with IntelliJ support

Related

How can we inject properties into wso2 Micro Integrator and Enterprise Integrator using file.properties?

I want to use the .car file on another server without using integration studio. So I want to be able to change the hostname and port dynamically using a configuration file. My endpoint URL has variables in it {uri.var.x} that's why I can't use $FILE:x to get the complete URL from file.properties.
I have already tried How to read a property injected from file.properties in WSO2 - micro integrator? but it did not work.
You can simply read the Property from the file and assign it to the variable you desire. Then use it in your Endpoint configurations.
<property expression="get-property('file', 'x')" name="uri.var.x"/>
You can store the values in a properties file called file.properties in the MI_HOME/conf folder and it will be loaded automatically. If you are using a different fileName you can pass it to the server startup script like -Dproperties.file.path=/home/dev/dev.properties. Then you can read them through a Property Mediator.
Further, if you want to construct the full URL from multiple properties you can use Xpath functions.
<property expression="concat('https://', get-property('file', 'host'), ':', get-property('file', 'port'))" name="uri.var.x" scope="default" type="STRING" />
If the properties are not picked from the default file, pass the file path like below.
sh micro-integrator.sh -Dproperties.file.path=./conf/file.properties
Update on WSO2 EI
It seems file scope is not supported in EI. But instead, you can read variables from Environment variables with get-property('env', 'NAME_OF_VARIABLE')
<property expression="concat('https://', get-property('env', 'host'), ':', get-property('env', 'port'))" name="uri.var.x" scope="default" type="STRING"/>
If you want to read them from a properties file, you can do something like the below. Assuming you have a properties file like below.
stockQuoteEP=http://localhost:9000/services/SimpleStockQuoteService
ycr=test1234
host=localycr
port=6676
Add the following script to integrator.sh to export the properties as environment variables. You can improve the script as you require.
while read line; do
echo "Exporting $line"
export $line
done < /home/wso2/wso2ei-6.6.0/conf/file.properties
Then in your integration read them as below.
<property expression="concat('https://', get-property('env', 'host'), ':', get-property('env', 'port'))" name="uri.var.x" scope="default" type="STRING"/>
Update 2 on File Scope in Property mediator
As Sanoj mentioned, file scope in the property mediator is only available from MI 4.0 onward vanilla packs. If you have a WSO2 subscription you can get it as an update for both MI and EI.

RTI DDS creating own data types

I am working on a .Net example where I define my own data type using RTI Connext DDS.
Instead of creating the application from the beginning, I got help from the source code of the hello_world_xml_dynamic example in rti_workspace directory. I have made several changes to the USER_QOS_PROFILES.xml file to create my own data type and changes its name to MY_PROFILES.xml
But when I compile the application and run it from the command line, I get the following error:
DDS_DomainParticipantFactory_create_participant_from_config_w_paramsI:ERROR: Profile library 'MyParticipantLibrary::PublicationParticipant' not found
! Unable to create DDS domain participant
The line of code that catching the error:
if (this.participant == null)
{
this.participant = DDS.DomainParticipantFactory.get_instance().
create_participant_from_config(
"MyParticipantLibrary::PublicationParticipant");
if (this.participant == null)
{
Console.Error.WriteLine("! Unable to create DDS domain participant");
return;
}
}
this is the configuration file MY_PROFILES.xml :
<!--
RTI Data Distribution Service Deployment
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.1/rti_dds_profiles.xsd">
<!-- Qos Library -->
<qos_library name="qosLibrary">
<qos_profile name="DefaultProfile">
</qos_profile>
</qos_library>
<!-- types -->
<types>
<struct name="FlightData">
<member name="Latitude" type="double"/>
<member name="Longitude" type="double"/>
<member name="Altitude" type="double"/>
</struct>
</types>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary" >
<domain name="FlightDataDomain" domain_id="0">
<register_type name="FlightDataType"
type_ref="FlightData" />
<topic name="FlightDataTopic"
register_type_ref="FlightDataType">
<topic_qos name="FlightData_qos"
base_name="qosLibrary::DefaultProfile"/>
</topic>
</domain>
</domain_library>
<!-- Participant library -->
<domain_participant_library name="MyParticipantLibrary">
<domain_participant name="PublicationParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<publisher name="MyPublisher">
<data_writer name="FlightDataWriter"
topic_ref="FlightDataTopic"/>
</publisher>
</domain_participant>
<domain_participant name="SubscriptionParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<subscriber name="MySubscriber">
<data_reader name="FlightDataReader"
topic_ref="FlightDataTopic">
<datareader_qos name="FlightData_reader_qos"
base_name="qosLibrary::DefaultProfile"/>
</data_reader>
</subscriber>
</domain_participant>
</domain_participant_library>
</dds>
where am i making a mistake?
Your XML file looks correct. From the 'not found' error message, it seems that you may not have taken the right steps to instruct your application to load that profiles-file MY_PROFILES.xml to actually learn about your desired Participant. You can easily verify that this is the case by introducing an error in your XML file (for example by incorrectly renaming one tag) and rerun your application. If it does not complain about the syntax or schema of the XML, then your file did not get loaded and this hypothesis is correct.
If that turns out to be your problem indeed, then you have several options to fix that. They are listed in the User's Manual section 18.5 How to Load XML-Specified QoS Settings.

IFilter with Custom properties

I'm developing a custom filter to my file format. Everything works fine when I use any of system keys from <propkey.h> like PKEY_Search_Contents.
But now I need to have my custom properties to register and use with Windows Search. Imagine:
"SELECT * FROM SystemIndex WHERE scope ='file:C:/' AND Publisher.Item.CustomProperty LIKE '%Test%'"
I saw about Property Handlers and already tested. I used the RecipePropertyHandler project from Windows 7 SDK Samples. And when I searched with this code:
// get a property store for the mp3 file
IPropertyStore* store = NULL;
HRESULT hr = SHGetPropertyStoreFromParsingName(L"SomePath",
NULL, GPS_DEFAULT, __uuidof(IPropertyStore), (void**)&store);
hr = HRESULT_FROM_WIN32(GetLastError());
PROPVARIANT variant;
store->GetValue(PKEY_Microsoft_SampleRecipe_Difficulty, &variant);
//// very important undocumented method
store->Release();
CoUninitialize();
I receive the correct answer.
But I don't understand how to union IFilter with IPropertyStore to create my custom properties. To start my IFilter, I used the example from Windows 7 SDK Samples. I'm doing something like:
chunkValue.SetTextValue(PKEY_SearchContents, filtered.c_str(),CHUNK_TEXT, 1046, 0, 0, CHUNK_EOS);
I didn't found the link anymore anymore but I read a quote of msdn about you can't implement IFilter AND IPropertyStore together. It's that true? Talking in other words, I can't create a custom property?
I saw all links from msdn, like link, link2 or any other.
I can do separate things but I don't know how to union both.
Any ideia how to implement?
EDIT
Im trying yet implement the PropertyHandler. My .propdesc file have this content:
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/windows/2006/propertydescription"
schemaVersion="1.0">
<propertyDescriptionList publisher="Microsoft" product="SampleRecipe">
<propertyDescription name="Microsoft.SampleRecipe.Difficulty" formatID="{1794C9FE-74A9-497f-9C69-B31F03CE7EF9}" propID="100">
<description>This property indicates the preparation difficulty of a recipe.</description>
<searchInfo inInvertedIndex="true" isColumn="true" />
<typeInfo type="String" multipleValues="false" isViewable="true" />
<labelInfo label="Recipe difficulty" invitationText="Specify recipe difficulty" />
<displayInfo displayType="Enumerated" >
<editControl control="DropList"/>
<enumeratedList>
<enum value="Easy" text="Easy" />
<enum value="Medium" text="Medium" />
<enum value="Hard" text="Hard" />
</enumeratedList>
</displayInfo>
</propertyDescription>
<propertyDescription name="Microsoft.SampleRecipe.Keywords" formatID="{16D19FCB-7654-48AB-8057-DF8E51CC0755}" propID="100">
<description>This property indicates the preparation difficulty of a recipe.</description>
<searchInfo inInvertedIndex="true" isColumn="True"/>
<typeInfo type="String" multipleValues="true" isViewable="true" />
<labelInfo label="Recipe Keywords" invitationText="Specify recipe keyword" />
</propertyDescription>
</propertyDescriptionList>
</schema>
On Windows Properties:
I receive all informations from file... but when I try to search with Windows Search like:
SELECT Microsoft.SampleRecipe.Keywords FROM SystemIndex
Where directory='somedirectory'
I receive all lines empty... Any ideias why?
EDIT
I can see my properties on PropSchema:
I can use my Microsoft.SampleRecipe.DifficultyV2 on my WSSQL Query like:
SELECT Microsoft.SampleRecipe.KeywordsV2 FROM SystemIndex WHERE directory='C:\users\step\documents\rvffilter\'
But all the contents are empty

Nhibernate connection error

I am using nhibernate 3.1.0, oracle 10g express edition and asp.net 3.5 MVC. I am getting error "ora 06413: connection not open" please help me to solve this problem. My Connection properties are:
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.connection_string">User ID=user;Password=pwd;Data Source=localhost:1521/XE</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
Just taking a stab here - but it looks like your connection string isn't formatted properly.
The connection string you're using appears to be for "XE Client", but I don't think that's what NHibernate uses. I'd be willing to be NHibernate is going to use something more similar to one of the Microsoft connection strings shown on that page.
In all the oracle connection strings I see at ConnectionStrings.com/Oracle it seems the properties "User ID", "Password", and "Data Source" are not valid.
You could also reference this example of using NHibernate with an Oracle server: http://tiredblogger.wordpress.com/2008/11/07/using-oracle-odp-with-nhibernate-from-a-c-class-library/
Apparently Oracle 10g is a bit finicky on 64-bit systems. The best option seemed to be switching to MySQL.
the usage of MySQL also provide more features in hibernate

Connect to ESRI Shape File (DBase *.dbf file) from NHibernate

I've been trying to work out how to connect to an ESRI shape file (which I think is a DBase table file) through NHibernate but haven't had any luck with anything I've tried.
Currently, my config's looking like this:
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<!--<property name="dialect">NHibernate.Dialect.GenericDialect</property>
<property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>
<property name="connection.connection_string">Database=A303.dbf;protocol=TCPIP</property>-->
<property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>
<!--<property name="connection.connection_string">driver={IBM DB2 ODBC DRIVER};Database=a303.dbf;protocol=TCPIP</property>-->
<property name="connection.connection_string">Provider=VFPOLEDB.1; Data Source=C:\projects\rm4\Sandbox\bin\Debug\A303.dbf;Extended Properties=dBase III</property>
<property name="dialect">NHibernate.Dialect.DB2Dialect</property>
<property name="use_outer_join">true</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="show_sql">true</property>
I've left the commented out bits in so you can see what values I've been trying. No matter what I try, I get the error message:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I've gone through most of the connection string I've found online and in some answers to questions on here was getting to the 'clutching at straws' phase where I'm just putting anything in so thought I'd better ask for help.
I'm not even sure if it's possible to connect to this type of file from NHibernate but, if it is, does anyone know what should be in the config?
A Shapefile (.shp) is not a dbf, per se. It actually is a collection of files, one of which is a DBF, but the shapefile itself that stores the geometry is a different format altogether.
There is a whitepaper on the ESRI website (www.esri.com)
I would try a different NHibernate driver. Here is a list of NHibernate drivers from the documentation.
Judging from the provider name in your connection string, I would try NHibernate.Driver.OleDbDriver.
Failing this, I would eliminate NHibernate from the mix and see if you can connect using the standard .NET data classes, such as System.Data.Odbc.OdbcConnection and System.Data.OleDb.OleDbConnection. If you cannot connect at this level, then the problem is not NHibernate.