For the second year in a row, computer science enrollments in the U.S. have increased, according to an annual study of enrollment trends, giving hope that the degree program is seeing a revival that's here to stay.

The decline in technology-related enrollments that began with the dot-com bust has been worrisome to business and government leaders. President Obama, in particular, has pushed for programs to train more secondary school teachers in science, technology, engineering and mathematics. He has gone so far as to urge students to eschew finance degrees in favor of technology areas.

The total number of undergraduate majors in computer science increased 5.5% in 2008-2009, the second consecutive year that the number of computer science majors has increased, according to the annual Taulbee Survey by the Computing Research Association. Over a two-year period, the number of such students increased to 14%. The survey looks only at a subset of computer science enrollments -- those students attending Ph.D.-granting institutions -- but it's typically the first data to identify enrollment trends in advance of government data. The figures represent a total of 32,706 computer science majors enrolled at these institutions, the survey said.

But the multiyear decline in enrollments has reduced the number of graduates and competition for jobs.

"Employers cannot find enough people who are graduating to hire," said Jeff Hollingsworth, a professor of computer science at the University of Maryland who also heads the undergraduate program. This past month, the university held a job fair specifically for computer science graduates in response to employer demand, he said. "The demand exceeds the production," he added.

At Maryland, there were 141 first-year computer science enrollments in the 2008-2009 academic year. For the 2009-2010 academic year, it had 210 first-year students.

Hollingsworth blamed some of the earlier enrollment decline on fears of offshoring, but he said most tech companies want their most interesting development work done in the U.S. "There are some concerns about offshoring, but I think the concerns were much greater than reality," he said.

Computer science enrollments may have also been helped by the collapse of some major Wall Street firms. Mathematically inclined students who might have once considered a degree in finance now see computer science as "the safe choice," said Peter Harsha, the Computing Research Association's director of government affairs.

Obama has also urged students to turn to technology areas. In an appearance on The Tonight Show with Jay Leno last year, Obama said: "We need young people -- instead of a smart kid coming out of school ... wanting to be an investment banker, we need them to decide if they want to be an engineer, they want to be a scientist, they want to be a doctor or a teacher."

But computer science is also being helped by its broadening application into other academic areas, such as computational biology, Harsha said. This "makes the problems of computer science more intellectually compelling," he contended. The decline in enrollments also prompted academic departments to revisit curricula to see what they could do to spice up programs, he added.

The enrollment gains are happening despite a tech market that has shrunk as a result of the recession. Although the students may be betting on an improving job market by graduation, Hollingsworth said that graduates from his program are finding jobs.

Patrick Thibodeau covers SaaS and enterprise applications, outsourcing, government IT policies, data centers and IT workforce issues for Computerworld. Follow Patrick on Twitter at @DCgov or subscribe to Patrick's RSS feed . His e-mail address is pthibodeau@computerworld.com.