Using the DatabaseConnectionManager to get connections
Answered
We hava custom plugin connecting to the DB (sybase) and fetching the compiled SP, so no re-synching is needed.
Changes made to the Api, broke the following code :
...
if (!dataSources.isEmpty()) {
Optional<LocalDataSource> sourceOptional = dataSources.stream().filter(localDataSource -> dataSourceName.equalsIgnoreCase(localDataSource.getName())).findFirst();
if (sourceOptional.isPresent()) {
try {
GuardedRef<DatabaseConnection> connectionGuardedRef = DatabaseConnectionManager.getInstance().build(project, sourceOptional.get()).create();
Connection connection = connectionGuardedRef.get().getJdbcConnection();
return connection;
}
...
The java.sql.connection was used with PrepearedStatement, is there a new better way to get the connection? or is it a better way
to just get the StoreProcedure current compiled definiton?
Is it possible to re-sync only a single StoreProcedure (the entire re-sync process takes too long to be done everytime)
Please sign in to leave a comment.
First of all I'd like to note that you are leaking resources. GuardedRef is Closable and should be closed.
JDBC API is no longer available in DG, you can use getRemoteConnection and crete RemotePreapredStatement from it.
These Remote* classes are wrappers around JDBC object located in side-process, previously they were wrapped in JDBC interfaces, we just stripped them.
Per-object introspection is still not implemented, but we're moving towards it, now you can use "Request and Copy Original DDL" to get sources directly from DB