Sun Microsystems ( JAVA) agreed to buy MySQL AB, an open-source software developer, in a deal valued at around $1 billion. The transaction should close late in the third quarter or early in the fourth quarter of Sun's fiscal 2008 and add to its operating income in fiscal 2010. Sun will pay approximately $800 million in cash for all of MySQL's stock and assume about $200 million in options. Separately, Sun said that for the second quarter ended Dec. 30 revenue likely rose 1% from the same period a year earlier to roughly $3.60 billion. Net bookings for the quarter were about $3.85 billion, an increase of 7% year over year. Gross margin is estimated to have risen about three points to around 48%. Sun says it earned 28 cents to 32 cents a share, when calculated using generally accepted accounting principles. Analysts surveyed by Thomson Financial are looking for a profit of 29 cents and a top line of $3.58 billion for the second quarter. Shares of Sun were rising 4% in early trading Wednesday.