Visit Our UNIX and Linux User Community

Edit hibernate config file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Edit hibernate config file
# 1  
Old 07-11-2008
Edit hibernate config file

I'd like to use a shell script to edit the params in my hibernate.cfg.xml file.
I need to substitute the database info(user name, password,url)

Here is a look at it:

 <session-factory name="">
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.url">jdbc:mysql://</property>
  <property name="hibernate.connection.username">user</property>
  <property name="hibernate.current_session_context_class">thread</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  <property name="hibernate.ignorecheck">true</property>
  <property name="hibernate.lib">hibernate3.jar</property>
  <property name="">Hibernate core</property>
  <property name="hibernate.version">3.0</property>
  <property name="hibernate.when">runtime, required</property>
  <property name="hibernate.jdbc.batch_size">20</property>
  <property name="hibernate.cache.use_second_level_cache">false</property>
  <mapping resource="mybeans/Position.hbm.xml"/>
  <mapping resource="mybeans/SecuMaster.hbm.xml"/>
  <mapping resource="mybeans/Trx.hbm.xml"/>
  <mapping resource="mybeans/FinancialAccount.hbm.xml"/>

I'm new to unix, what should I use or how to approach?
# 2  
Old 07-11-2008
A sed script along these lines should do the trick:

sed '
' originalfile > modifiedfile

Basically it replaces anything between > and < with the new value on the matching line.

Previous Thread | Next Thread
Test Your Knowledge in Computers #444
Difficulty: Easy
Scientific Linux is an Enterprise Linux rebuild sponsored by Fermi National Accelerator Laboratory.
True or False?

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Hibernate and Suspend

I have a C++ program which ends up getting run on every conceivable distro. What I can't do in C++, I can do by shelling out to the O/S. I am trying to find a portable way to send the system into hibernate and suspend modes. For users who have pm-utils, of course, I can use that, but I am trying... (4 Replies)
Discussion started by: BrandonShw
4 Replies

2. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

3. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

4. Shell Programming and Scripting

Edit a config file using shell script

I need to edit a config file using shell script. i.e., Search with the 'key' string and edit the 'value'. For eg: below is what I have in the config file "configfile.cfg". Key1=OldValue1 Key2=OldValue2 I want to search for "Key1" and change "OldValue1" to "NewValue1" Thanks for your... (7 Replies)
Discussion started by: rajeshomallur
7 Replies

5. Red Hat

Hibernate in Linux

1) How to enable Hibernate in Linux ? 2) Does compiling kernel from source code alters the current setup of the kernel after implementation Thx in advance, siva. (3 Replies)
Discussion started by: Sivaswami
3 Replies

6. Linux

How to enable Hibernate

Hi, I want to enable hibernate in my machine. when i click hibernate option, it is throwing message that hibernate is not enabled in kernel. earlier, i was hibernating in the same machine with windows os. any idea ? Thx in advance. Siva (0 Replies)
Discussion started by: Sivaswami
0 Replies

7. AIX

AIX, Hibernate, Java 1.5 website problem

We have an AIX machine running Tomcat 5.0.28 along with Java 1.5. There are two web application on there however when we start Tomcat and unpack the WAR files only one of the sites work. Then if we remove the working site then the other site starts to work. So it appears that one is taking... (0 Replies)
Discussion started by: coaxis
0 Replies

8. Shell Programming and Scripting

Perl CGI to access / edit "root" owned config files

I am trying to write a CGI program which accesses UNIX configuration files and changes them as required. The thing is, I don't want the CGI program to be "root" owned - it's Perl based! Is there any way that the Perl CGI program can request a username and password - and then use this to... (1 Reply)
Discussion started by: WIntellect
1 Replies

Featured Tech Videos