Import Java, SQL Statement;
Import the Java. SQL. The ResultSet;
Import the Java. SQL. DriverManager;
Public class ExcelReader
{
Public static void main (String [] args)
{
The Connection of c=null;
The Statement STMNT=null;
Try {
Class.forname (" sun. JDBC. Odbc. JdbcOdbcDriver ");
C=DriverManager. GetConnection (" JDBC: odbc: Book1 ", ""," ");
STMNT=Arthur c. reateStatement ();
String query="SELECT test1 FROM [Sheet1 $] WHERE test1='test'";
The ResultSet rs=STMNT. ExecuteQuery (query);
System. Out. Println (" Chad match the records of test1 'test' is: ");
While (rs), next ())
{
System. The out. Println (rs. Get string (" test1 "));
}
}
The catch (Exception e)
{
System. Err. Println (e);
}
The finally
{
Try {
STMNT. Close ();
Arthur c. lose ();
}
The catch (Exception e)
{
System. Err. Println (e);
}
}
}
}
CodePudding user response:
May be in the wrong place behind plus a "} "less, because I also encountered this problem, I was in the wrong place behind plus a"} ", it is not an error,CodePudding user response:
You didn't error code I posted here