Topic
No replies
SystemAdmin
SystemAdmin
4447 Posts
ACCEPTED ANSWER

Pinned topic Database list from java

‏2012-02-08T09:59:39Z |
Hi to all,
there is a way to retrieve the database list from java using the JDBC driver with these information:
host,port,user and password.
wiht mysql I use this method, but with db2 retrieve null

Connection c = (Connection) DriverManager.getConnection("jdbc:mysql://",settings.get(2), settings.get(3));
java.sql.DatabaseMetaData md = c.getMetaData();
ResultSet rs = md.getCatalogs();
while (rs.next()) {
System.out.println(rs.getString(1));
}

thanks to all,
best regards.