ResultSet resultSet = stmt.executeQuery(query); CachedRowSet crs = new CachedRowSetImpl();
//com.sun.rowset.CachedRowSetImpl
crs.populate(resultSet);
Saturday, June 25, 2011
CachedRowSet
Access DB Connection from standalone application
public static Connection getDatabaseConn() throws NamingException{ Context ctx=null; Connection conn = null; Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); env.put(Context.PROVIDER_URL,"t3://127.0.0.1:7001"); ctx = new InitialContext(env); try { dataSource = (DataSource) ctx.lookup("ExtDevDB");
//jndi datasource name
} catch (NamingException e) { e.printStackTrace(); } try{ conn = dataSource.getConnection(); }catch(Exception e){ e.printStackTrace(); }finally{ } return conn; }
Use t3 protocol to connect Weblogic server.
Sunday, June 12, 2011
Subscribe to:
Posts (Atom)