(AP) -- German business software maker SAP AG has agreed to buy Sybase Inc. in a $5.8 billion deal that ratchets up SAP's rivalry with database leader Oracle Corp.

The acquisition is the first big move by SAP's new co-CEOs Bill McDermott and Jim Hagemann Snabe, who took over in February after the previous CEO, Leo Apotheker, suddenly resigned. The resignation came amid concerns over SAP's faltering finances and its ability to counter the mounting threat from Oracle.

SAP and Oracle are battling to run more of the programs that corporations use to manage their data. Their businesses overlap even more with SAP's purchase of Sybase.

As the world's leading maker of business-software applications, SAP has had the luxury of being largely quiet when it comes to acquisitions. It hasn't had to buy its way in to many new markets.

Its last major acquisition was in 2008, when it bought Paris-based Business Objects for $6.8 billion. That company's "business intelligence" software helps companies analyze their data and spot patterns to help them make decisions.

Oracle, meanwhile, has been on a $40 billion buying binge since 2004 in what in most cases has been an attempt to muscle into SAP's markets.

Oracle's primary business is making database software, an area where it's the world's leader with more than 40 percent of the market. Databases help companies store their information and retrieve it later through computer programs. Sybase is a small player in that market, with about 2 or 3 percent market share. Its absorption by SAP puts SAP into more direct competition with Oracle in that area.

Oracle declined to comment.

SAP said the acquisition also gives it technology that's useful in a fast-growing area: making business software run on mobile phones. Making applications and data that's stored inside a corporate network easily accessible on "smart" phones is a technical challenge that SAP says Sybase's software will help it solve.

Additionally, Sybase operates a messaging network that reaches 4 billion mobile subscribers and allows its customers to reach their customers and employees by sending alerts and do transactions via mobile devices.

McDermott, the SAP co-CEO, said the deal combines "the world's best business software with the world's most powerful mobile infrastructure platform." He called it a "game-changing transaction" for SAP and Sybase customers.

SAP is offering $65 for each outstanding share of Sybase's common stock. Sybase's stock hadn't closed above $50 per share since the mid-1990s.

Before the announcement, shares of Sybase rose 35 percent to $56.14 on rumors of the deal. In extended trading, stocks rose an additional 15 percent to $64.30.

The deal is expected to close in the third quarter, provided it is cleared by antitrust regulators. SAP, based in Walldorf, Germany, said the deal will immediately add to SAP's earnings. Sybase is headquartered in Dublin, Calif., in a building that's across a freeway from the old headquarters of PeopleSoft, the SAP and Oracle rival that Oracle bought in 2004 after a bruising fight that kicked off Oracle's acquisition binge and transformation into a bigger threat to SAP. Oracle now occupies the building.