//Database connection using DataSource in Oracle using JNDI names, Server running on Weblogic 9.2:
JARs required:
classes12.jar
weblogic.jar
xbean_bea.jar
//Java code
import java.sql.Connection;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class DataSourceConnection {
public static void main(String[] args) {
Connection connection = null;
try {
Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
jndiProperties.put("java.naming.provider.url", "t3://10.200.101.156:7001");
InitialContext context = new InitialContext(jndiProperties);
DataSource dataSource = (DataSource) context.lookup("jdbc/obodb_XA_ds");
connection = dataSource.getConnection();
System.out.println("Connection successful.."+connection.isReadOnly());
System.out.println(dataSource);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Friday, December 31, 2010
Thursday, December 16, 2010
URL/Link for Advanced Servlets
Link for advanced servlets:
http://www.exforsys.com/tutorials/j2ee/servlets-advanced.html
Hibernate loggers:
http://stackoverflow.com/questions/1380898/how-do-i-get-more-debug-messages-from-hibernate
http://www.exforsys.com/tutorials/j2ee/servlets-advanced.html
Hibernate loggers:
http://stackoverflow.com/questions/1380898/how-do-i-get-more-debug-messages-from-hibernate
Subscribe to:
Posts (Atom)