Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Oracle Driver Prob, JDBC

  • 22-03-2006 07:42PM
    #1
    Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭


    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, Registered Users 2 Posts: 1,991 ✭✭✭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