1 | package tutorial.jdbc.oracle; |
2 | import java.sql.*; |
3 | public class myTest { |
4 | public static void main (String argv[] ) throws Exception |
5 | { //load the driver class from the local CLASSPATH |
6 | Class.forname("weblogic.jdbc.oci.Driver"); |
7 | //connect to the database using the driver url and |
8 | // other properties like username, password and server |
9 | Connection conn = |
10 | DriverManager.getConnection("jdbc:weblogic:oracle:kayak", |
11 | "scott", "tiger") |
12 | //statement class is instantiated using the connection |
13 | // class for executing queries |
14 | Statement stmt = conn.createStatement(); |
15 | stmt.execute("select * from empdemo"); |