0

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!

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

But I can't encode this. I must work on plain string. Don't worry it's not real system :)
If you pass the parameter value like above, you will get the plain string when you use request.getParameter("db")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.