Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
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.