The wildest, craziest, most death-defying (Mormon) mogul on the planet!

February 5, 2014, 10:00 PM UTC

Josh James didn’t have time to be sick. Only a few years after selling his software company Omniture to Adobe for $1.8 billion, he was about to close a $125 million round of financing for Domo, his young enterprise-software company. This wasn’t the moment to take a day off.

So James, 40, tried to ignore the sore throat that had been building since a brief trip to Thailand in November. Still, it was worrisome. The soreness wasn’t anything he had ever experienced. James was in constant pain, as if a golf ball had lodged itself in his trachea. It was becoming hard to breathe. He had a fever, too, with his temperature occasionally spiking to a dangerous 104 degrees. Antibiotics lowered the temperature briefly, but then it returned with even more savagery.

James kept working, traveling from his Utah home to San Francisco and New York in early December for meetings. But his breathing was so shallow that he had to go to emergency rooms in Utah and San Francisco. The doctors helped ease his symptoms but couldn’t figure out the cause; his Utah physician sent his throat-culture samples for tests.

At the end of a cross-country flight to New York City on Dec. 11, James finally got a diagnosis. He was seated in first class next to Domo’s president, Chris Harrington. The two spent the flight strategizing, leaning close over the armrest to keep others from overhearing. James was so exhausted he could barely concentrate. Just before the Wi-Fi signal shut off for landing, an email arrived from his doctor: James’s body was harboring Neisseria meningitidis — a bacterium that causes meningitis. The disease is highly contagious and can be fatal.

The doctor ordered him not to come within six feet of other people and to report to an emergency room immediately. James abruptly slid away from Harrington, forwarded the doctor’s email, and texted, “Don’t talk to me. Read your email. I’m sorry.” Once the plane landed, James told his driver to take him to Lenox Hill Hospital on Manhattan’s Upper East Side.

There the receiving doctor delivered a stark message: James had 48 hours to live. Medics rushed him to an isolation room, where they coated the inside of the windows with plastic. A nurse wearing a protective full-body suit ran an IV into an artery to push a massive dose of antibiotics directly into his heart. Then she quickly departed.

For hours, James was left alone, his body racked with chills. Every few minutes the IV bag would slip from its holder and its monitor would begin bleating, but nobody came to adjust it. After three or four hours, he says, he was finally able to get the attention of the nurses, followed by that of the hospital’s head of infectious diseases.

Despite his isolation, his fever, and the doctor’s statement that his death was imminent, James felt strangely calm. He didn’t believe he was about to die, though he did reflect on his life. As James puts it, “I remember thinking, I know I’ve been honest in all my relationships and tried my hardest to be a great friend and brother and dad and husband. I wish I’d been a little nicer to my wife.”

Then, almost as fast as it began, the crisis abated. James’s body began responding to the antibiotics, and his fever dropped. Sometime around 2 a.m. — about eight hours after he entered the hospital — a doctor arrived with good news. The bacteria had been sealed in an abscess, a protective coating his body had made, and trapped in his throat. The disease had not spread to the rest of his body. He was likely to survive.

Within days, James was working from his hospital bed. He called Nehal Raj, a principal at TPG, which was on the point of agreeing to lead a new round of funding for Domo. “Hey, it’s Josh James. Where are we at?” On Dec. 17 — less than a week after being told he had 48 hours to live — James joined Raj and TPG partner Bryan Taylor in a private dining room at Spice Market, a trendy Asian restaurant in Manhattan’s Meatpacking District, to toast their imminent deal, which would value Domo at more than $800 million. James updated his TPG partners on his near-death experience, pulling the sleeve of his sweater up to reveal an IV still taped to his arm. “Look, before we sign,” said Raj, “is there anything else we should know about your condition and recovery?”

“No,” said James. “I’m going to be just fine.”

Josh James embraces contradictions. He’s a devout Mormon — but also the antic life of any party. He’s the sort of person who, at a customer retreat, clambers — stone-cold sober — onto a piece of art around 4 a.m. and climbs to a balcony above it. In this real-life escapade, James decided the most efficient way back down was to jump from the balcony to a sofa 20 feet below. He hit his target but snapped his leg in two.

James’s exuberance comes naturally, but he knows it’s got some practical benefits too. Like Marc Benioff of Salesforce.com (a friend and mentor), James is an impresario, casting a colorful, attention-attracting glow over a software company whose product, though functional and valuable, isn’t something the typical layperson would find spellbinding.

James inspires trust and loyalty in colleagues and friends, and his friends are everywhere, from Hollywood to Silicon Valley and beyond. He invests alongside Will Smith and Jay Z (James got them into Uber). Having become fluent in Japanese during a religious mission, he is on the board of Rakuten, the Amazon of Japan, and pulls all-nighters with founder Hiroshi Mikitani in Tokyo’s hippest karaoke bars. His investors include the likes of Amazon’s Jeff Bezos and Benioff. “You meet that guy, and you know he’s going somewhere,” says Benioff.

When he’s not in Thailand or Tokyo, you’ll find James at home in Utah County. That’s where he started Omniture, the web-measurement company he sold to Adobe in 2009 for $1.8 billion (his personal haul: $130 million). It’s where he’s doing a good deal of his own investing; he has seeded more than 30 companies in the area. And it’s where he’s building Domo, a business intelligence company that sells a highly visual and simple analytics dashboard for executives.

His personal agenda is larger than simply building another billion-dollar tech business; James aspires to become Utah’s Larry Ellison, a more benevolent version of the mogul so powerful he controls industries, determines fortunes, and can, if he wants, buy a Hawaiian island. Having just celebrated his 40th birthday, James figures he has another three decades to work — assuming he doesn’t break something more significant than a leg in one of his stunts. He believes that Domo, which he plans to hold on to, will be his Oracle, a company so substantial it will grow to rival the traditional enterprise-software giants.

James remembers attending the opening of the Benioff Children’s Hospital in San Francisco. “I’d just that day given a million dollars to my alma mater, Brigham Young University, and I was feeling pretty good about that,” he says. “Then Benioff invited me out for the opening of a hospital. He’d given $100 million to create it, and I thought, I want to do that.”

Everybody, it seems, has a good Josh James story. Dave Bateman recounts the time last summer that James persuaded him and a half-dozen other Utah entrepreneurs to climb up on the edge of a train track in the middle of the night. “I said, ‘Josh, you swear we’re not going to die, right?’ ” says Bateman, founder of the software company Property Solutions.

James had invited them up to his family’s cluster of homes on Idaho’s Lake Pend Oreille, 75 miles south of the Canadian border. The trip was a bonding exercise, part of James’s commitment to building Utah’s entrepreneurial community. They compared notes on hiring, traded investment advice, and staged a PG-13 version of a frat party, complete with O’Doul’s nonalcoholic beer. After a number of rounds of the dice game Farkle, James cajoled Bateman and five other CEOs into following him out to the spot where a train crossed the north edge of the lake. Between the track and the trestle’s edge, there was a metal grate about a foot wide. The men lumbered up onto the trestle and followed James onto the bridge. There they lined up along the grate, clutching a metal railing behind them as they waited in the chill of the pitch-black night. Then a train’s roar swelled, followed by the blinding glare of a headlight charging out of the darkness. The engine whipped by so closely that its draft shook the men. “It’s 99.9% safe, and logically you know it,” says James. “But as soon as the train comes, everyone is doing a gut check.”

The trestle experience, it turns out, is a James family tradition dating to his childhood, when his parents used to rent a house at the Idaho lake. James’s father was a Marine colonel, which meant James moved 17 times as a child (he calls Chicago his hometown). James’s parents encouraged their son, the oldest of six (all but one an entrepreneur), to try everything life offered. At 12 he was the smiling blondie on a TV commercial for Kellogg’s Honey Smacks who walked across a television screen on his hands. (Watch the video.)

James’s mother was a fervent Mormon, his father a convert, and the children were raised in that faith. Today James’s life combines religious devotion with a sort of adolescent boy’s fantasy life. His capacious home includes an indoor basketball court, a movie theater, and a music studio with a signed U2 poster, and he keeps a 1978 Trans Am (similar to the model Burt Reynolds drove in Smokey and the Bandit, a James favorite) next to the Porsche 911 in the garage. But James also tithes. And he and his wife, Cherie, want their six daughters to have “a relatively normal existence.” So the girls share bedrooms and load their own plates into the dishwasher every night.

Like many entrepreneurs, James followed a winding path. He spun through seven majors at Brigham Young University — interrupted by two years of missionary work in Japan — before he became so enthralled by a course on entrepreneurship that he persuaded another classmate, John Pestana, to drop out of school with him to start an Internet company. They hawked Pestana’s wedding presents to buy their first computer, and James financed the rest of the endeavor on credit cards and student loans. He was newly married himself at the time, and Cherie pitched in as the part-time receptionist.

In the fall of 2000, the web-design company NetObjects offered to buy James and Pestana’s startup in an all-stock deal. Happy day! The Salt Lake Tribune published an article titled HOW TWO BYU DROPOUTS MADE THEIR FIRST $57 MILLION. The governor of Utah visited and posed for a photo. Then NetObjects went bankrupt, and the deal was off. James and Pestana quickly ran out of money. Two weeks before Christmas, James herded three-quarters of his employees into a stairwell and laid them off with no severance. The experience wrecked James. Night after night he found himself sitting wide awake on his bathroom floor at 3 a.m.

Humbled by the prospect of losing everything, James, Pestana, and the executive team redoubled their efforts. They rebranded and reinvented the business as a tool to help companies measure web traffic. Within a year growth picked up, and Omniture began to dominate web analytics. In 2006, James took Omniture public, becoming, at 33, the youngest CEO of a publicly traded company. Shortly before the initial public offering, James looked up all 82 of the employees he had fired. He issued them each checks for two weeks’ pay.

One of James’s strengths is his ability to manage and motivate people. His secret is a candor that teeters on the thin edge between brilliant and pathological. “Josh doesn’t respect or appreciate social boundaries,” says Chris Harrington, his longtime colleague. “He doesn’t appreciate that there are some things that are sensitive,” adds Harrington, pausing as if puzzled himself. “And it works for him.”

There was the time James approached the dour former CIA director George Tenet. Now chairman of the tony investment boutique Allen & Co., Tenet happened to be attending the same conference as James. Shortly after a friend briefly introduced them, James found himself sitting near Tenet during a session on security. “You get one shot with a guy like that,” James says. He leaned over and whispered, “You must think this stuff is really boring.” Tenet appeared taken aback, and the encounter was awkward. But Tenet soon warmed to James. The men had dinner in New York City, and eventually Allen & Co. represented Domo when the company raised money.

James’s blunt approach sometimes backfires. Before the last presidential election, candidate Mitt Romney was interested in getting help from James’s tech team. James was a huge supporter and fan. He met with Romney and offered his unsolicited diagnosis of the candidate’s image problems: “It’s cool to back Obama,” he remembers saying. “What’s going to keep people from thinking of you as the rich white conservative Mormon guy? We’ve got to hook up cameras and make videos of you just being real.” James was not invited to meet with Romney a second time.

James brings this outrageousness to Domo as well. The signature feature of its headquarters is a 10-foot aluminum rooster that he spotted at a roadside pawnshop one day. He had it delivered to his new office, a 300-person building just off Interstate 15 in American Fork, and spray-painted it powder blue. He parks it next to the company’s top salesperson each month — its butt jutting awkwardly out of cubicles.

James’s style didn’t serve him at Adobe. In September 2009, after he sold Omniture to Adobe, he joined it as a senior vice president. According to press reports, he clashed with CEO Shantanu Narayen. Maybe it was the “midgets” James says he hired to perform at the corporate Halloween party. More likely, James’s aggressive and blunt nature didn’t sit right within Adobe’s hierarchical corporate culture, and he chafed at being a cog rather than the man in charge. At any rate, the following July, James left to pursue a new venture. He started Domo, then beefed it up by acquiring a tech company called Corda Technologies.

James’s schism with Adobe intensified after he left. The company sued James in Utah, primarily alleging that he was violating a noncompete clause by recruiting Adobe employees to work for his new company; James sued in California, alleging unfair competition. (James needled his opponent with a practical joke: He hired a team of little people again, this time to stage a phony protest at Adobe headquarters in which they claimed the company refused to hire undersized workers.) Adobe’s suit was dismissed, and James’s case settled in August 2012. Neither party would comment on the suits, citing the terms of the settlement. But a few months later, when Adobe hosted the grand opening of its Utah campus — which essentially consists of James’s former company — his name was not mentioned in the ceremony. James and his wife attended, seated near the back of the auditorium, only because a state senator insisted they be invited.

Harrington says the lawsuits seasoned James. “Before, he had this youthful acceptance of people,” says Harrington. “I think it made him trust people a little less.”

The idea for Domo came from a very real problem James experienced as CEO of Omniture. Big data’s promise is that all the information available about a business will make an executive smarter. But James found that it doesn’t work that way in real life. More often, all that information is trapped in multiple systems, databases, spreadsheets, and presentations that don’t talk to one another. James decided to build a simple real-time dashboard to help executives understand what’s going on in their companies at any given moment.

Of course, any number of software outfits are aiming to do just that. From small but entrenched players like Seattle-based Tableau to the big guns like Oracle and IBM, companies are competing for every dollar. The challenge has as much to do with design as technology, and that’s where James and his team excel. It’s a stretch to compare him to Steve Jobs, but like the late Apple founder, James is less a coder than somebody blessed with the rare ability to grasp how people actually need technology to function and how to translate that into simplicity.

To understand how Domo is different, spend time with Aidan Lyons, who does fan marketing for the NFL. Lyons didn’t think he needed Domo, but he had known James since the Omniture days. A year ago he agreed to try the product and found that it was adept at penetrating a thicket of data and providing actionable insight. For example, he pulled together a dashboard of a half-dozen metrics — such as top postings on the web and social media, and the location of fans — to help the public relations team better understand its audience. As a result, the NFL was able to react to a recent concern fans raised in real time, sending an email immediately. “It had a 50% response rate, which is practically unheard-of,” Lyons says. He plans to expand the relationship with Domo.

It’s been 18 months since James signed his first paying customer. Now he has more than 500 customers, and so far, James says, almost no one has dropped the service. That’s what has interested TPG and the rest of the investors that have rushed to get in on Domo’s latest round. It will bring the company’s total funding to $250 million, plenty of capital to last James until he takes the company public. He expects that will happen in the next couple of years.

But for perhaps the first time in his life, he’s not in a rush. Maybe it’s his age and the experience he’s gathered over the past two decades in business. He knows the early days of any endeavor are fun. Or perhaps it’s a deepened perspective that comes from almost dying. James knows this is the ride, right now. He plans to enjoy it.

This story is from the February 24, 2014 issue of Fortune.