Bonding of semiconductor wafers to insulating substrates or to semiconducting substrates using an intermediate insulating layer