Results 1 to 3 of 3
  1. #1
    OMFGITSROHIT is offline Member
    Join Date
    Mar 2010
    Posts
    23
    Rep Power
    0

    Default jdbc connectivity error

    What driver can I use for database connectivity with Oracle 9i? I created a new driver using administrative tools --> Data sources(ODBC).

    I'm having trouble establishing database connectivity.

    Java Code:
      private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                      
    String user= new String(jTextField1.getText());
    String pass= new String(jPasswordField1.getPassword());
    if(a<4)
    {
    Connection con = null;
    String driver = "oracle.jdbc.driver.OracleDriver";
    String user1 = "system";
    String pass1 = "manager";
    try{
    Class.forName(driver);
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/test",user1,pass1);
    Statement s=con.createStatement();
    ResultSet password=s.executeQuery("Select pass from login where username="+user);
    s.close();
    con.close();
    if(pass.contentEquals(password.getString(1)))
    {
        a=0;
        JOptionPane.showMessageDialog(rootPane, "Access Granted");
        ResultSet access=s.executeQuery("Select access_power from login where username="+user);
        access_power=access.getString(1);
        new Exam_Season().setVisible(true);
        this.setVisible(false);
    }
    else
    {
        JOptionPane.showMessageDialog(rootPane, "Access Denied.");
        a++;
    }
    }
    catch(Exception e)
    {
    e.printStackTrace();
    JOptionPane.showMessageDialog(rootPane, "Connection not successful.");
    }
    }
    else
    {
        JOptionPane.showMessageDialog(rootPane, "Too many attempts.");
        System.exit(0); 
    }
    
        }

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    366
    Rep Power
    6

    Default

    What error do you get?

    You can always download JDBC driver,
    like "ojdbc14.jar" place it in classpath and try.

    regards

  3. #3
    OMFGITSROHIT is offline Member
    Join Date
    Mar 2010
    Posts
    23
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 12-09-2009, 10:58 AM
  2. Help me this error in JDBC-ODBC connection
    By lordelf in forum Java Servlet
    Replies: 3
    Last Post: 04-04-2009, 09:37 AM
  3. Replies: 0
    Last Post: 04-01-2008, 11:17 AM
  4. JDBC error
    By ARADHYEV in forum JDBC
    Replies: 0
    Last Post: 01-09-2008, 09:56 AM
  5. Replies: 0
    Last Post: 09-28-2007, 01:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •