-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Can I connect oracle DB with dynamic user/password
PostPosted: Sun Jul 05, 2009 3:08 am 
Newbie

Joined: Sun Jul 05, 2009 2:57 am
Posts: 2
Hello all,

We are considering using Hibernate in one of our projects.
According to customer's requirements we need to connect to the DB (oracle) using the DB users, which means that we need to dynamically set the username / password for connecting to the DB at runtime.

(The users of the application should connect to the application with their DB users and the application will use this username to connect to the DB)

Has anybody done it in hibernate ? is it possible ?


Top
 Profile  
 
 Post subject: Re: Can I connect oracle DB with dynamic user/password
PostPosted: Mon Jul 06, 2009 12:43 am 
Beginner
Beginner

Joined: Wed Jun 17, 2009 9:03 pm
Posts: 31
Location: mumbai
Try something like this.

Configuration config = new Configuration();
config.setProperty("hibernate.connection.url", init.getDatabaseUrl());
config.setProperty("hibernate.connection.username", init.getDatabaseUser());
config.setProperty("hibernate.connection.password", init.getDatabasePass());
config.configure();
sessionFactory = config.buildSessionFactory();


Top
 Profile  
 
 Post subject: Re: Can I connect oracle DB with dynamic user/password
PostPosted: Mon Jul 06, 2009 3:09 am 
Newbie

Joined: Sun Jul 05, 2009 2:57 am
Posts: 2
Thanks prateek.singh !
This helps a lot !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.