This is another entry in the “really simple but still seems to take forever to get working” family of Mathematica tricks. Mathematica can, in theory connect to any JDBC data source, but it is not always obvious what magic set of options and commands will be required. For PostgreSQL, the trick is all in the arguments to
JDBC. The first one needs to be “PostgreSQL”, and the second needs to be the hostname and database name, separated by a slash. Basically, this second argument is going to get stuck on to the end of a JDBC connection string, so you can (presumably) also include stuff like port numbers and so forth.
In:= Needs["DatabaseLink`"]; In:= dbconn = OpenSQLConnection[JDBC["PostgreSQL", "YOUR_HOST_NAME/YOUR_DB_NAME"], Username -> "USERNAME", Password -> "PASSWORD"] Out= SQLConnection[3, "Open", "Catalog" -> "topic_gen", "TransactionIsolationLevel" -> "ReadCommitted"]
« Back to notes