Click here to Skip to main content
15,886,783 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Java
import javax.swing.*;               //COURSE TABLE
import java.awt.*;                     
import java.awt.event.*;
import java.sql.*;

public class per7
{ 
    public static void main(String args[])
    {
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con = DriverManager.getConnection("jdbc:odbc:datbas");
            Statement sta = con.createStatement();
            ResultSet rs =sta.executeQuery("select student_name from reg where reg.10th_marks >= 70);
             // System.out.println("course_name\tcourse_number\t\tcapacity\tfees_per_year");
            while(rs.next())
            {
                System.out.println(rs.getString(1));
            }
            rs.close();
            sta.close();
            con.close();
          
        } catch (Exception ex)
        {
            System.out.println("the exception is "+ex);
        }     
    }
}


error am getting is::
per7.java:16: error: unclosed string literal
ResultSet rs =sta.executeQuery("select student_name from reg where reg.1
0th_marks >= 70);
^
per7.java:16: error: ';' expected
ResultSet rs =sta.executeQuery("select student_name from reg where reg.1
0th_marks >= 70);

^
per7.java:18: error: not a statement
while(rs.next())
^
per7.java:18: error: ';' expected
while(rs.next())
^
4 errors
Posted
Updated 12-Mar-15 9:20am
v3
Comments
Tomas Takac 12-Mar-15 15:20pm    
I updated formatting on your code sample. Have a look, you sure can see the "unclosed string literal" now.
ZurdoDev 12-Mar-15 16:00pm    
You're missing the closing " on your sql statement.
Richard MacCutchan 13-Mar-15 5:06am    
The error message is actually telling you what is wrong, and on which line of your program.
MOHANAVAMSI CHIDIPILLI 13-Mar-15 13:13pm    
and mentioned jdbc:odbc:datbas grmatical mistake ... i guess... i tshould jdbc:odbc:datbase
Richard MacCutchan 13-Mar-15 13:23pm    
What?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900