Sponsors: Michael Fertik - Best JAVA Web hosting Company & 30% off


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-14-2010, 03:37 PM
Member
 
Join Date: Mar 2010
Posts: 23
Rep Power: 0
OMFGITSROHIT is on a distinguished road
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.

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); 
}

    }
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 03-16-2010, 04:00 PM
FON FON is offline
Senior Member
 
Join Date: Dec 2009
Location: Belgrade, Serbia
Posts: 307
Rep Power: 1
FON is on a distinguished road
Default
What error do you get?

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

regards
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 03-16-2010, 05:10 PM
Member
 
Join Date: Mar 2010
Posts: 23
Rep Power: 0
OMFGITSROHIT is on a distinguished road
Default
Class not found is the error I get.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL exception error in JDBC conection with servlet+ jsp morya123 New To Java 2 12-09-2009 09:58 AM
Help me this error in JDBC-ODBC connection lordelf Java Servlet 3 04-04-2009 08:37 AM
How to use JDBC Template classes to control basic JDBC processing and error handling Java Tip Java Tips 0 04-01-2008 10:17 AM
JDBC error ARADHYEV Database 0 01-09-2008 08:56 AM
How to use JDBC Template classes to control basic JDBC processing and error handling JavaBean Java Tips 0 09-28-2007 12:56 PM


Java Forums is supported by the best jsp hosting.

All times are GMT +2. The time now is 05:58 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org