I am trying to migrate an web application from Weblogic to JBOSS 4.0.2 and have
got the
data sources setup.
In the Weblogic world, I setup the connection pools thru the Weblogic console
and then as part
of my application, I read the db specific props from a property file and a
class creates the
connection for me.
//Properties File
app.database.driver=weblogic.jdbc.pool.Driver
app.database.url=jdbc:weblogic:pool:MyOraclePool
app.database.property.weblogic.t3.waitForConnection=true
app.database.property.weblogic.t3.waitSecondsForConnection=5
//Java Code
Connection connection = null;
Driver driver = null;
String dburl = //load from app properties file
String driverClassName = //load from app properties file
Properties dbProperties = //load from app properties file
// Load the driver.
try
{
Class driverClass = Class.forName(driverClassName);
driver = (Driver) driverClass.newInstance();
}
catch (Exception ex)
{
throw new ApplicationException("Failed to load JDBC driver :" +
driverClassName, ex);
}
try
{
connection = driver.connect(dbURL, dbProperties);
}
catch (Exception ex)
{
throw new ApplicationException("Failed to create a database connection
with the specified settings.", ex);
}
In the JBOSS world, isnt there any way wherein I can reference the connection
pool directly? Is it that I always
have to get a connection the Datasource way ?
Connection con = null;
try
{
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:/MyOracleDS");
con = ds.getConnection("username","password");
}
catch(Exception ex)
{
throw new ApplicationException("Failed to create a database connection
with the specified settings.", ex);
}
Any replies will be highly appreciated.
cheers
Vinay
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885886#3885886
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3885886
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user