// Import the following packages to use JDBC.
import java.sql.*;
import java.io.*;
import oracle.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;
class SignIn {
public static void main( String args[ ] ) throws SQLException {
String user = "C##userid";
String password = args[0].trim( );
String database = "65.52.222.73:1521/cdb1";
// Open an OracleDataSource and get a connection.
OracleDataSource ods = new OracleDataSource( );
ods.setURL ( "jdbc:oracle:thin:@" + database );
ods.setUser ( user );
ods.setPassword( password );
try {
System.out.println( "<html><body>" );
System.out.println( "<font color='#3366CC' face='Helvetica'><h3>" );
Connection conn = ods.getConnection( );
if ( conn != null ) {
System.out.println( "Successfully connected!" );
conn.close( );
}
}
catch( SQLException e ) {
System.out.println( e );
}
System.out.println( "</h3></font></body</html>" );
}
}
|