Share on Google+Share on Google+

ajay2124lv
SQLException caught: No data found
0 Answer(s)      5 years and a month ago
Posted in : Java Beginners

i m using ms office 2010, n when i run my source code it is giving error SQLException caught:No data found, plz help me why i am getting this exception, thanks alot, my source code is as :

import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.print.*; import sun.audio.*; import java.io.*; import java.sql.*; class loginevati extends JFrame implements ActionListener { JLabel l,l1,l2; JTextField t,t1; JPasswordField p; JButton b,b1; JPanel p1,p2,p3,p4,p5,p6,p7; Container c; Color c1=new Color(128,128,128); private Image img;

loginevati()
{
  c=getContentPane();
  //setLayout(new FlowLayout(FlowLayout.CENTER));

  l=new JLabel("              EVATI");
  l.setFont(new Font("TimesNewRoman",Font.BOLD,30));
  l.setForeground(Color.black);

  ImageIcon i=new ImageIcon("natureevati.jpg");
  img=i.getImage();
  //JLabel li=new JLabel(i);

  t=new JTextField("  English Voice And Accent Training Institute");
  t.setFont(new Font("TimesnewRoman",Font.BOLD,15));
  t.setForeground(Color.white);
  t.setBackground(Color.green);
  t.setEditable(false);
  t.setPreferredSize(new Dimension(330,10));

  l1=new JLabel("User Name");
  l2=new JLabel("Password  ");

  l1.setForeground(Color.blue);
  l2.setForeground(Color.blue);

  b=new JButton("Login");
  b.setForeground(Color.blue);

  b1=new JButton("Change Password");
  b1.setForeground(Color.blue);

  t1=new JTextField(10);
  p=new JPasswordField(10);
  t1.setForeground(c1);
  p.setForeground(c1);

  p1=new JPanel();
  p1.add(l);
  p1.add(t);
  p1.setLayout(new GridLayout(2,1));
  p1.setBackground(c1);

  p7=new JPanel();
  p7.add(p1);
  p7.setLayout(new FlowLayout(FlowLayout.CENTER));

  p2=new JPanel();
  p2.add(l1);
  p2.add(t1);
  p2.setLayout(new FlowLayout(FlowLayout.CENTER));

  p3=new JPanel();
  p3.add(l2);
  p3.add(p);
  p3.setLayout(new FlowLayout(FlowLayout.CENTER));



  p4=new JPanel();
  p4.add(b);
  p4.add(b1);
  p4.setLayout(new FlowLayout(FlowLayout.CENTER));

  p5=new JPanel();
  p5.add(p2);
  p5.add(p3);
  p5.add(p4);
  p5.setLayout(new GridLayout(3,1));

  p6=new JPanel();
  p6.add(p7);
  p6.add(p5);
  p6.setLayout(new GridLayout(2,1));



  c.add(p6);
  c.setLayout(new FlowLayout(FlowLayout.CENTER));
  //c.setBackground(img);

  b.addActionListener(this);


}

public void actionPerformed(ActionEvent e)
{
  if(e.getSource()==b)
  {
     String s=t1.getText();
     String ss=p.getText();
     System.out.println(s);
     System.out.println(ss);
     try
     {
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       Connection con=DriverManager.getConnection("jdbc:odbc:evati1");
       Statement st=con.createStatement(); System.out.println("u got is  ajay the great");
       ResultSet rs=st.executeQuery("select * from login where username='"+s+"' and password='"+ss+"'");

       String uname="",pass="";
       while(rs.next())
       {
         uname=rs.getString("username");
         pass=rs.getString("password");
       }
        if(s.equals(uname) && ss.equals(pass))
        {

        }

     }
      catch(ClassNotFoundException ee)
{
  System.out.println("eer");
}
 catch(SQLException eee)
{
  System.out.println("SQLException caught:"+ eee.getMessage());

}
  }
}
public static void main(String args[])
{
  JFrame k=new loginevati();
  k.setTitle("LOGIN");
  k.setSize(500,500);
  k.setVisible(true);
  k.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
}

}

Ads

View Answers









Related Tutorials/Questions & Answers:
SQLException caught: No data found
SQLException caught: No data found  i m using ms office 2010, n when i run my source code it is giving error SQLException caught:No data found, plz...) { System.out.println("eer"); } catch(SQLException eee) { System.out.println
SQLException:Column not found? (help me:(
SQLException:Column not found? (help me:(  import javax.swing.... extends JFrame implements ActionListener { String userid="data",password="1234...() { super("Store Data"); setSize(300,400
Advertisements
ODBC driver manager return 'Data source name not found.
ODBC driver manager return 'Data source name not found.  Why does the ODBC driver manager return 'Data source name not found and no default driver specified Vendor: 0
JDBC Class Not Found Exception
; } JDBC ClassNotFoundException And SQLException ClassNotFoundException...());     } If the database driver class not found then it throws ClassNotFoundException. The catch block must handle this class not found exception
Path was not found
Path was not found  The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path
identifier not found
identifier not found  Getting compilation error " identifier not found " please explain ?   identifier means variable name,,,,make sure it same as declaration
File not found
not found
File not found
not found
File not found
"(specified file not found
File not found
"(specified file not found
File not found
getting an error "emp_code.doc"(specified file not found)  Hi Friend
Steps not found.
Steps not found.  import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; public class Details1 extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse
File not found
not found)  Hi Friend, Visit Here Thanks
mycustomer.hbm.xml not found
(); //Query q=s.createQuery("from mycustomer"); //q.setCacheable(true); //l... name="p1.mycustomer" table="fedback_data"> <composite-id name="name" type...; </property> <property name="quality"> <column name="Q"/>
mycustomer.hbm.xml not found
(); org.hibernate.Session s=sf.openSession(); Transaction t=s.beginTransaction(); //Query q...="p1.mycustomer" table="fedback_data"> <composite-id name="name" type...;/property> <property name="quality"> <column name="Q"/> <
class not found exception
class not found exception  org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterprint("code sample
javascript image not found
javascript image not found  javascript if image not found   <a href='$image'> <img alt='No Image' src='$image' onError="this.parentNode.onclick=function() {return(false);}"> </a>
javax.servlet not found error
javax.servlet not found error  why iam getting javax.servlet error while running my servlet program...after setting the classpath also i am finding that problem
no def found - JSP-Servlet
no def found  i have used the code of file upload from rose india but when i run no def found for fileupload exception although i have put jar file in lib folder code i get from D:\project\Uploading Employee Profile
CLASS NOT FOUND EXCEPTION
CLASS NOT FOUND EXCEPTION   I AM USING INTERNET EXPLORER VERSION 6.00... NOT FOUND EXCEPTION AND THE BOX IS DISPLAYED AND I CLICK ON DETAILS BUTTON...: trigger logging q: hide console r: reload policy configuration s
class not found error - JDBC
class not found error  thanks for your response. please clarify the following doubts. i am having the specified mysql connector jar file. where that jar file has to be placed. also does the jdbc driver need to be installed
ejabberd_ctl.beam not found - Solved
ejabberd_ctl.beam not found - Solved  Hi, I installed ejabberd ejabberd-16.01-linux-x86_64-installer.run but it is giving following error: [email protected]:/opt/ejabberd-16.01/bin# ./ejabberdctl available_modules =ERROR REPORT
Error:No Class Found Exception:org.postgresql.driver
Error:No Class Found Exception:org.postgresql.driver  Error:No Class Found Exception:org.postgresql.driver while connecting JDBC With PostgreSQL 8.4 I m running My Program with java 6.0
unable to import class com.opensymphony.xwork2.ActionContext not found
unable to import class com.opensymphony.xwork2.ActionContext not found  Imported class com.opensymphony.xwork2.ActionContext not found gettin the above error
http 404 resource not found error
http 404 resource not found error   Sir, I have downloaded your RichLRApplication and deployed on tomcat 6 with oracle backend. Application started... not found error. Kindly advise. ss
Java file not found exception
Java file not found exception This section illustrates you the concept of file not found exception. Java provides a powerful concept of Exceptions... by a code. When a file with the specified pathname does not exist, file not found
MySQL server PID file could not be found! [FAILED]
MySQL server PID file could not be found! [FAILED]  MySQL server PID file could not be found! [FAILED
exception handling code for file not found error..
exception handling code for file not found error..  How to do exception handling for file not found error
Tutorials   
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads