James Glynn entered the United States Navy on March 4, 1815. He became a lieutenant in 1825, a commander in 1841, and served on the California coast during the Mexican–American War. He was put in command of the sloop-of-war USS Preble (16 guns) and sent to China.
In Canton, he learned from the Dutch consul about the imprisonment at Nagasaki of 15 American sailors from the whaleship Lagoda, who had been shipwrecked on the northern Japanese island of Yeso on June 7, 1848. Although the coast of Japan was poorly known, and the American Commander James Biddle, with the ships USS Columbus and USS Vincennes had been recently repelled by the Japanese in the bay of Edo (Tokyo), Glynn was ordered by David Geisinger to leave for Nagasaki, where he arrived on April 17, 1849.
The sailing orders to Captain Glynn recommended both caution and firmness in his enterprise:
In your correspondence with the Japanese, your conduct will be conciliatory but firm. You will be careful not to violate the laws or customs of the Country, or by any means prejudice the success of any pacific policy our government may be inclined to pursue. Nevertheless you may be placed in situations which cannot be foreseen. In all such cases, every confidence is reposed in your discretion and ability to guard the interests as well as the honor of your country— National Archives Microfilm Publication M89; Larson 1994 .
The Japanese tried to block the entrance to Glynn's ship, but he forced his way through a row of boats and anchored in the middle of the bay of Nagasaki. Despite Japanese menaces, he insistently demanded the release of the prisoners, and threatened an intervention of the United States. With some help from the Dutch in the negotiations, the prisoners were finally delivered to him on April 26.
The sailors had suffered throughout their internment, and after several attempts to escape were put in cages where several died of exposure. Another had hanged himself, and was left hanging in his cage for two days. Ranald MacDonald was also among the party of the rescued, although he had traveled to Japan of his own will and taught English to several Japanese during his internment in Nagasaki, becoming the first American to teach English in Japan.
The Preble returned to Hong Kong and the prisoners finally returned to the United States on December 31, 1849, where the story of their harsh internment made a sensation.
Following his voyage, Glynn made a proposition to the United States government to open relations with Japan through diplomacy, and, if necessary, by a show of strength. His recommendation paved the way for the expedition of Commodore Matthew Perry in 1853 and 1854.
Glynn was made a captain in 1855.
- Arnold, Bruce Makoto (2005). Diplomacy Far Removed: A Reinterpretation of the U.S. Decision to Open Diplomatic Relations with Japan (Thesis). University of Arizona. 
- United States Navy (1850). Deposition of Ranald MacDonald regarding his imprisonment in Japan, made to Commander James Glynn, USS Preble. G.P.O.Available online through the Washington State Library's Classics in Washington History collection Senate executive document, 31st Congress, 1st session, no. 84