I created local database in DB2 called \"TestDB\" then I created table called \"TestTable\".
I found that the table is put under schema name is
The problem was The table I created in db2 has schema name "yasmin"
I used username and password "db2admin/db2admin" In JDBC connection
so it search for the table in this schema "db2admin"
so I need to set the schema to be "yasmin"
so I added the following lines of code after creating
the connection
String schemaName="yasmin";
if (schemaName != null && schemaName.length() != 0) {
try {
statement = connection.createStatement();
statement.executeUpdate("set current sqlid = " + schemaName);
System.out.println("The schema is set successfully.");
} catch (SQLException exception) {
exception.printStackTrace();
}
and grant db2admin all privilages on this table in db2
1-Right click on the table choose privilages
2-Click on "Add user" button
3-then write the username "db2admin" and click "apply" button
4-Then select the user you just add and click "gtant all" button
Now he can see the table.
Many Thanks @Mark Rotteveel and @bhamby for your help.