Posts

Showing posts from 2011

UNLOCK USER ACCOUNT (CMD)

LOG IN AS DBA SQL> ALTER USER scott ACCOUNT UNLOCK; AFTER UNLOCKING THEN CHANGE PASSWORD SQL > ALTER USER SCOTT IDENTIFIED BY IKELOSTREET.

How to connect to your database

public class connect_tomcat { String foo = "Not Connected"; int bar = -1; public void init() { try{ Context ctx = (Context) new InitialContext(); if(ctx == null ) throw new Exception("Boom - No Context"); DataSource ds = (DataSource)((InitialContext) ctx).lookup("java:comp/env/jdbc/TestDB"); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { foo = "Got Connection "+conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( "select nom from user_table"); if(rst.next()) { String nom=rst.getString(2); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } }