I have an access database and trying to use it in java. I want to select it and wrote a statement as
String sql="SELECT * from numeric;";
try
{
rs=s.executeQuery(sql);
while(rs.next())
{
System.out.println(rs.getString(1));
}
}
The executeQuery is throwing an exception as
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
I think the select statement I wrote is correct. Even if i write as
SELECT Webservice FROM numeric;
also gives me an error where Webservice is my column name.
Your table is called numeric
which is also an SQL data type. The SQL parser thinks its a data type and your query fails. If you have reserved keywords like this as table names you need to put the table name in parenthesis:
SELECT * FROM [numeric]