ok here is my problem in the below shown program i am trying to pass data from txt file to a table,but i get error on StringTokenizer method(nexttoken)i am unable to get the output please if anybody can solve my problem of what is actualy wrong with this program.
public class ReadingText { public static final String Records="Records"; public static void main(String[] args) throws NoSuchElementException {
What is the error that you are getting? Is it a compiler error or an exception at runtime? If so, what is the exception? Did you try to understand the error message?
If you want to parse a string into parts delimited with "/", then String.split() is probably an easier solution than using StringTokenizer.
Also, consider using PreparedStatement instead of concatenating SQL statements like you are doing in your code.
This kind of code is vulnerable to SQL injection. [ May 23, 2007: Message edited by: Jesper Young ]
hi jesper! Now i am getting more confused because first when i was running the program i was getting the error at line tk.nextToken("/"),and it was showing error "no suggestions avaliable".Now when i am running the program i am getting the following error.Now what is the problem with driver?
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ';'. at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338) at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253) at client.com.kolkata.Read.ReadingText.main(ReadingText.java:38)
dhwani mathur
Ranch Hand
Joined: May 08, 2007
Posts: 621
posted
0
ok,i tried to locate the main error its coming on the statement "stmt.executeQuery(query);" As the query is not getting executed,my program is not giving the output. There is no error of driver.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.