Depending on the type of camera you use, you may be able to photograph stars without a telescope. I know that there are apps for cell phones that allow you to take long exposures, and there are some point-and-shoot cameras that have a "bulb" setting or allow multi-second exposures, and certainly an SLR-type will allow it. You'll need to stablize your camera thought.
Either way you can use either a transmission diffraction grating (glass or low-cost flexible film-type) or a wedge prism to disperse light into different colors.
If you use a free-standing camera, you can afix the dispersing element in front of the camera's lens. If you are photographing through a telescope you'll need to put it at the camera end. The disperser will usually spread light out by several degrees or several tens of degrees, so if you put it in front of the telescope lens the spectrum will be spread out way too far, unless you are using a very low-dispersion grating or prism specifically designed to be put in front of a telescope!
If the disperser partially covers the camera, then you'll get both an image of the star and of the spectrum. That's helpful to identify the position of lines, since you can measure the distance from the undispersed star to each line. If you use a grating that is not blazed or imperfectly blazed, then you'll get both +1 and -1 orders and you can measure the distance between the two appearences of a line without needing the central start, but it will be there anyway because most gratings will pass at least some of the 0th order.
Since the star light is spread out over a much larger area, the spectrum will be much dimmer than the undispersed image, so as you mention, you'll have to overexpose.
There's an example of a commercial product in the question Has anyone seen an actual spectrum of a satellite made by an amateur photographer?
I don't mean to advocate a commercial product, this is a handy example, and Tom Field is a contributing editor to Sky and Telescope magazine.

above: from here.

above: from here
See the FieldTestedSystems' YouTube video How to capture star spectra in your backyard