How to fix Error: Unresolved compilation problems: Syntax error on token "rs"

user4575853

Can someone please tell me what is the compilation error

"Exception in thread "main" java.lang.Error: Unresolved compilation problems: Syntax error on token "rs", delete this token The method getString(int) is undefined for the type String at SelectTest.main"

in the below java code

//SelectTest.java
import java.sql.*;
public class SelectTest1
{
    public static void main(String args[])throws Exception
    {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection("jdbc:odbc:oradsn","System","123");
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery("select*from student");
        {
            while(rs.next())
            {
                System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "rs.getString(3));
            }
            rs.close();
            st.close();
            con.close();
        }
    }
}
ruirodrigues1971

The last rs.getString(3) you forget '+'

System.out.println(rs.getInt(1)+" "+rs.getString(2)+" " +rs.getString(3));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to fix the Exception in thread "main" java.lang.Error: Unresolved compilation problem:Syntax error, insert "}" to complete ClassBody error?

"Error: Unresolved compilation problems" with Wowza module

how to fix reactjs syntax error: unexpected token?

Exception in thread "main" java.lang.Error: Unresolved compilation problems:

How to fix "Unresolved reference" error in Kotlin?

Cannot fix Syntax error: Unexpected token '<'

How to fix 'error: Error: syntax error - at value'

How to fix a syntax error in Grub?

Why do I get this error in Java? Exception in thread "main" java.lang.Error: Unresolved compilation problems

How to fix python Syntax error unicodeescape error?

How to fix "Parse error: syntax error, unexpected '}"

How to fix illegal start of expression compilation error?

How to fix error with pyinstaller after compilation in exe

Compilation error: Exception in thread "main" java.lang.Error: Unresolved compilation problems with findElement(By.Id()) using Selenium Webdriver

Exception in thread "main" java.lang.Error: Unresolved compilation problems(String)

What is causing the "syntax error near unexpected token `do'" and how can I fix it?

How do I fix emscripten link error unresolved symbol: glBlitFramebuffer

How to fix unresolved identifier error and correctly call functions in Swift?

How to fix unresolved identifier 'stopRunning' error for AVcapture session

How to fix "Unresolved reference " error in Kotlin Android Studio 3.3

How to fix unresolved reference error in my C program

How to fix syntax error in SWITCH function

How to fix/ignore syntax error in github

how to fix discord embed showing syntax error

Python 3.4 Syntax error and how to fix it

How to fix this MySql syntax error in PHP?

How to fix a syntax error with print in Python 3?

How to fix syntax error in postgresql UPSERT?

SQL WHEN function - How to fix Syntax Error?