Original Post
I'm creating a simple interface for a mysql database, and I need to create interactively a table. I do as follows, and it seems to work: Just after that, I try to fill it with new rows: but at newt.moveToInsertRow(); it throwns an exception, with the following message: Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details. Where is the problem? [Edited by - cignox1 on October 14, 2005 7:41:50 PM]
String cmd = "create table "+name+" (";
try
{
ResultSetMetaData meta = data.getMetaData();
for(int i = 1; i <= meta.getColumnCount(); i++)
{
if(i > 1) cmd = cmd+",";
cmd = cmd+" "+meta.getColumnName(i)+" "+meta.getColumnTypeName(i)+"";
if(meta.getColumnClassName(i).compareTo("java.sql.Date") == 0 ||
meta.getColumnClassName(i).compareTo("java.sql.Time") == 0) continue;
cmd = cmd+"("+meta.getColumnDisplaySize(i)+")";
}
cmd = cmd+" )";
executeQuery(cmd);
Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet newt = stat.executeQuery("select * from "+name);
System.out.println(name);
newt.moveToInsertRow();