Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.DriverManager;
- import java.sql.Connection;
- import java.sql.SQLException;
- public class OracleJDBC {
- public static void main(String[] argv) {
- System.out.println("-------- Oracle JDBC Connection Testing ------");
- try {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- } catch (ClassNotFoundException e) {
- System.out.println("Where is your Oracle JDBC Driver?");
- e.printStackTrace();
- return;
- }
- System.out.println("Oracle JDBC Driver Registered!");
- Connection connection = null;
- try {
- connection = DriverManager.getConnection(
- "jdbc:oracle:thin:@fourier.cs.iit.edu:1521:orcl", "jpatel98",
- "jay57717");
- } catch (SQLException e) {
- System.out.println("Connection Failed! Check output console");
- e.printStackTrace();
- return;
- }
- if (connection != null) {
- System.out.println("You made it, take control your database now!");
- } else {
- System.out.println("Failed to make connection!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment