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.
This is an algorithm of what I want to do:
for(iterate through the jtable and pass each row values to the sql statement)
Class.forName(getDriver rows here);
Connection con = DriverManager.getConnection(getDatabase url here, getUsername, getPassword);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from getTableName where field = getFieldName");
The Question is can I achieve this? and Can someone give a clue to do this (codes will be welcome), or any other method to achieve this.