# Simple PostgreSQL transport usage ## Prerequisites Ensure a PostgreSQL server is running and accessible. This sample connects to `localhost` on port `54320` using the credentials in the connection string. The database named `nservicebus` must exist before running the sample. ## Running the sample 1. Start both the Sender and Receiver projects. 1. Press c to send a [command](/nservicebus/messaging/messages-events-commands.md), or e to publish an [event](/nservicebus/messaging/messages-events-commands.md), from Sender to the Receiver. 1. The Receiver handles the message. ## Code walkthrough ### Configuring the PostgreSQL transport ```cs var connectionString = "User ID=postgres;Password=mysecretpassword;Host=localhost;Port=5432;Database=nservicebus;Pooling=true;Connection Lifetime=0;Include Error Detail=true"; var routing = endpointConfiguration.UseTransport(new PostgreSqlTransport(connectionString) { TransportTransactionMode = TransportTransactionMode.SendsAtomicWithReceive }); routing.RouteToEndpoint(typeof(MyCommand), "PostgreSql.SimpleReceiver"); ```