A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
how 2 access specific datasource using java code as per user requirement
Joined: Sep 14, 2010
Sep 14, 2010 07:42:35
Hi WL users
we have one specific requirement like below.
we have 2 databases where one db is for uat & one for training. for each db, one datasource is available in weblogic console.
is their a way to access either of them using
coding as per user requirement?
Joined: Aug 31, 2010
Sep 14, 2010 08:34:30
yes there is a way to access the
datasource configured in weblogic using java code.. Suppose you have the UAT datasource as "projectUAT", then you have to code in java as :
dataSourceName = "projectUAT";
ctx = new
ds = ctx.lookup(dataSourceName);
javax.sql.Connection conn = ds.getConnection();
//you can use the connection object as you like after this.
//you need to envelope this code snippet in proper try/catch block.
I agree. Here's the link:
subject: how 2 access specific datasource using java code as per user requirement
Java and DB Design problem.
Reuse of Data Source
Dynamic Datasource invocation at runtime in JSF-EJB3-MySql application on Eclipse3.4.1-JBoss5.0.0
Java Desktop Applications
How to use configured datasource
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014