I connect to postgres by placing the following in a file on a remote server, opening over tramp, and executing:
(setq sql-connection-alist '((pool-my_db (sql-product 'postgres) (sql-server "localhost") (sql-user "postgres") (sql-password "postgres") (sql-database "my_db") (sql-port 5432)) )) ;; emac25: (sql-set-product-feature 'postgres :prompt-regexp "^.*=# ") (defun sql-connect-preset (name) "Connect to a predefined SQL connection listed in `sql-connection-alist'" (eval `(let ,(cdr (assoc name sql-connection-alist)) (noflet ((sql-get-login (&rest what))) (sql-product-interactive sql-product))))) (sql-connect-preset 'pool-my_db)
If I execute the same script in the context of a different remote server, it just switches to the buffer for my first session. Is there a way to open subsequent SQL sessions in a new buffer so I can have multiple remote sql shells open at the same time?