package com.control;
import java.sql.*;
public class DBHelper {
Connection conn;
Statement st;
ResultSet rs;
public DBHelper() throws ClassNotFoundException {
Class.forName( "oracle.jdbc.driver.OracleDriver" );
}
public boolean getConnection() throws SQLException {
conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:xe" , "system" , "system" );
if ( conn != null )
return true;
return false;
}
public void execute( String query ) throws SQLException {
st = conn.createStatement();
st.execute( query );
}
public static void main( String args[] ) throws Exception {
DBHelper db = new DBHelper();
if ( db.getConnection() )
System.out.println( "Logged In" );
}
}
I have been trying to run the class with this command :
java -cp "C:\Users\dell\Desktop\MYServlet\WEB-INF\lib\ojdbc5.jar;" com.control.DBHelper
Error: Could not find or load main class com.control.DBHelper
It compiles Sucessfully but doesn't run.