Jamming with others is great and will definitely have a positive effect on your playing.
But
It won't teach you the fundamentals of music and how to apply it on bass..
The best way learn this, IMO, is with a good teacher and regular practice routine.
So in short, I think both are important.