Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Oracle Driver Prob, JDBC

Options
  • 22-03-2006 7:42pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    NB: those smiley face aren't ment to be there!
    Connection conn;
    OrackeDriver driver;
    Statement stmt;
    String url = "jdbc:oracle:oci:@global1";
    driver = new oracle.jdbc.driver.OracleDriver();
    DriverManager.registerDriver(driver);
    conn = DriverManager.getConnection(url, "username",
    "password");

    this is the code but i get this error:
    C:\Tomcat\webapps\site\WEB-INF\classes\User\UserData.java:13: <identifier> expected
    driver = new oracle.jdbc.driver.OracleDriver();
    ^
    1 error
    from this line:
    driver = new oracle.jdbc.driver.OracleDriver();


Comments

  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Got it, it was teo things for people that may get this problem:
    1) Spelling:
    its
    OracleDriver driver;
    not
    OrackeDriver driver;
    2) method:
    These lines of code must be within a method and should also be within a try catch block.

    driver = new oracle.jdbc.driver.OracleDriver();
    DriverManager.registerDriver(driver);
    conn = DriverManager.getConnection(url, "username", "password");


Advertisement