I have a table in my database which I displayed in my GUI program using a JTable. The JTable contains driver, database URL, username, password, table name, and field name / Fields columns respectively. I want to loop through this JTable rows, get their values and pass it this sql statements.
Welcome to CodeRanch! I added code tags to make your post easier to read.
I'm not sure what you are asking. Are you getting an error? Are you asking how to connect the Swing part to your database code?
Also, a piece of JDBC advice: try this with a PreparedStatement instead of a Statement. It lets you use a ? to substitute values each time you call it. Which is faster and clearer for this type of work.
Thanks for re-organizing the code. And I have taken note of your correction. What I want to do is to try and implement the algorithm (I mean the code). The code is more like an algorithm of what i want to do. So i need help on writing the code to actually achieve something like that. Like I said earlier, I have a jtable which has database information. Each row of the database would have different databases like the first one could be for mysql, the second for ms access, the third for sqlite, the fourth for hsqldb, etc. So i want a code that will loop through this jtable of different databases, then get each row values(which is database and its information like the driver, table name, Field name, database address) and pass it to the sql statement. Why I am trying to do this, is that I created an application that would allow a user to add a database/ databases to this application. So the application which has to do with searching a database should be able to look at any database added and search through it. I do not know if there is any other way to do this, but if there is, I don't mind changing my method. But if not i hope to get answer to based on what i have asked. I hope my reply is clear, Thanks.