Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connecting to MOM using propertries files  RSS feed

 
Patrick ODonnell
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm am trying to connect to MQSereis and SonicMQ using a Java Application I have written.
The way you specify the JNDI initial context differ slightly Between. Is possible to load these from a properties file?? And if so how is this done as I don't know much about property files??
Thanks,
Patrick
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the Javadoc on java.lang.Properties. It's really pretty easy -- a Properties can be read from a text file with the format key=value...
Kyle
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Properties class has a load() method that can read an InputStream. So you can create a FileInputStream and use it as the parameter for the load. At that point you can treat the Properties object the same way you treat a Hashtable to get the value when you specify a key.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!