Message Boards Message Boards

0
|
3494 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Anybody know anything about JDBC and Postgres?

I'm struggling with the JDBC connection at the moment. I can use the database connection GUI easily enough, and it works. The trouble I'm having is trying to do it with just typing in the parameters that I want and connecting that way. My end goal is to be able to just run code in bash terminal to connect there, but I can't seem to get it right. Is there a way to SEE the code that Mathematica uses to connect with the GUI so that I can just use that to connect easily?

POSTED BY: Brian Cavallaro
5 Replies

Also, for some reason the "Username"/role that is entered had to match the user account I am logged into on my computer. PostgreSQL is new to me at the moment, so this might just be a n00b mistake.

POSTED BY: Brian Cavallaro

For those who are curious, I was able to connect successfully with the changes to my code below. I changed "localserver" to "127.0.0.1". It then spat out some role error, so I went into the database and played around the roles for the db and now it seems to be good. I'll post any new discoveries here since I haven't seen many people post about this stuff on the board, and I wish there were more here about it.

OpenSQLConnection[JDBC["PostgreSQL", "127.0.0.1:5432/world_db"], 
 "Username" -> "postgres", "Password" -> "$Prompt"]

The $Prompt is great because you can just type any username and password right in there!

Attachments:
POSTED BY: Brian Cavallaro

And now that I thought of it, here is a screen grab of the code I'm trying at the moment. I'm trying to connect to a Postgres db.

Attachments:
POSTED BY: Brian Cavallaro

Brian it is always good to copy-paste code in a special code block so other members can easily use it. This should be useful to you:

READ FIRST: How to post and use Wolfram Community

POSTED BY: EDITORIAL BOARD

oh okay! I'll fix it up. :-)

I wish there were emoji on this board...

POSTED BY: Brian Cavallaro
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract