Bakus123
Bakus123

Reputation: 1399

Connection string as parameter of GET/POST request

I get in my servlet as a request parameter a connection string to mysql database for example:

db=jdbc:mysql://localhost:3306/baza?user=root&password=pass1234

And it's a problem because method request.getParameter("db") return only part of the connection string to &. The rest is interpreted as a next param. I tried use request.getQueryString().substring(3) but it work's only for GET request. Any idea how can I resolve my problem?

I can't encode request!

Upvotes: 0

Views: 352

Answers (1)

gmarintes
gmarintes

Reputation: 1308

The parameter value for your GET/POST request needs to be URL encoded like this:

db=jdbc%3Amysql%3A%2F%2Flocalhost%3A3306%2Fbaza%3Fuser%3Droot%26password%3Dpass1234

You can use sites like this to encode strings that you want to pass as parameter to your GET/POST request.

Upvotes: 1

Related Questions