建立在数据库开发视图的连接(我叫雷QA
),双击打开一个连接,然后运行:
:
IConnectionProfile profile = ProfileManager.getInstance().getProfileByName("QA");
Database db = getDatabase(profile);
if (db != null) {
System.out.println("DB Vendor: " + db.getVendor());
System.out.println("DB Version: " + db.getVersion());
}
getDatabase
方法从this page末取
private Database getDatabase(IConnectionProfile profile) {
IManagedConnection managedConnection = ((IConnectionProfile) profile)
.getManagedConnection("org.eclipse.datatools.connectivity.sqm.core.connection.ConnectionInfo");
if (managedConnection != null) {
try {
ConnectionInfo connectionInfo = (ConnectionInfo) managedConnection.getConnection().getRawConnection();
if (connectionInfo != null) {
Database database = connectionInfo.getSharedDatabase();
return database;
}
}
catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
也发现'{d:'2014-07-03'}'是特殊的[JDBC语法](http://www.mindprod.com/jgloss/jdbc.html#LITERALS) –