/** * Get the dialect of a given IDatabaseConnection * * @param connection IDatabaseConnection object to get the dialect of * * @return IDatabaseDialect of the given connection */ @POST @Path( "/getDialectByConnection" ) @Consumes( { APPLICATION_JSON } ) @Produces( { APPLICATION_JSON } ) @Facet ( name = "Unsupported" ) public IDatabaseDialect getDialect( IDatabaseConnection connection ) { return super.getDialect( connection ); }
/** * Get the dialect of the given IDatabaseType * * @param databaseType IDatabaseType object to get the dialect of * @return IDatabaseDialect containing the dialect of databaseType */ @POST @Path( "/getDialectByType" ) @Consumes( { APPLICATION_JSON } ) @Produces( { APPLICATION_JSON } ) @Facet ( name = "Unsupported" ) public IDatabaseDialect getDialectWS( IDatabaseType databaseType ) { return super.getDialect( databaseType ); }
DriverManager.registerDriver( driver ); DatabaseDialectService dialectService = new DatabaseDialectService(); IDatabaseDialect dialect = dialectService.getDialect( connection );
public static SQLConnection getConnection( String connectionName ) throws DatasourceServiceException { IDatabaseConnection connection = null; try { ConnectionServiceImpl service = new ConnectionServiceImpl(); connection = service.getConnectionByName( connectionName ); DatabaseDialectService dialectService = new DatabaseDialectService(); IDatabaseDialect dialect = dialectService.getDialect( connection ); String driverClass = null; if ( connection.getDatabaseType().getShortName().equals( "GENERIC" ) ) { driverClass = connection.getAttributes().get( GenericDatabaseDialect.ATTRIBUTE_CUSTOM_DRIVER_CLASS ); } else { driverClass = dialect.getNativeDriver(); } return new SQLConnection( driverClass, dialect.getURLWithExtraOptions( connection ), connection.getUsername(), connection.getPassword(), null ); } catch ( ConnectionServiceException e1 ) { return null; } catch ( DatabaseDialectException e ) { return null; } }
IDatabaseDialect dialect = dialectService.getDialect( connection ); String driverClass = null; if ( connection.getDatabaseType().getShortName().equals( "GENERIC" ) ) {
connection.setPassword( "" ); //$NON-NLS-1$ IDatabaseDialect dialect = dialectService.getDialect( connection ); String driverClass = null;