Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I attempted to concatenate a string to the url parameter of the below in order to set the protocolVersion, but I'm not sure how to keep the string in the url without altering the name of the database, so I kept getting a database name error.

String protocolVersion = "&2";
String url = "jdbc:postgresql://" + host + ":" + port + "/" + database + protocolVersion;
Connection connection = null;
connection = DriverManager.getConnection(url, user, password);

I am using PostgreSQL 9.2, but I was getting lag so I want to try to see if I can optimize by using an older protocol version.

share|improve this question
    
This kind of general question is a better fit on Stack Overflow than it is here. –  Jason Scheirer Dec 26 '12 at 19:30
    
I attempted to migrate this post, but its owner is blocked from asking questions on SO. –  whuber Dec 26 '12 at 19:54
    
Please use EXPLAIN on your query to figure out the slowness. Might be easily addressable with an index or two. –  Jason Scheirer Dec 28 '12 at 9:30
add comment

closed as off topic by whuber Dec 26 '12 at 19:53

Questions on Geographic Information Systems Stack Exchange are expected to relate to geographic information systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 2 down vote accepted

It is formatted something like a URL with parameters delimited after the ?. Per the manual I found online, it should be:

String url = "jdbc:postgresql://" + host + ":" + port + "/" + database + "?protocolVersion=" + protocolVersion;

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.