PreparedStatement POST request?
Hi guys, I got a very weird question...
I am using PreparedStatement and DBConnection for my SQL in my Project, the point is, you can set strings or ints with stmt.setString(VALUE), what I would like to do is, read a link out of a .properties file for example https://google.com and then modify the URL at certain points, for example https://google.com=?aasfn902q3basfsiopadh234r?
replace the "?" with a variable or something else.
Basically just like setString in PreparedStatement but for POST requests, but I guess that this is not done by using a SQL package but something else.
Any ideas lmk
Google
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
10 Replies
⌛
This post has been reserved for your question.
Hey @netty.bootstrap! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
I don't think you understand what PreparedStatement is for
PreparedStatement ensures that values are transmitted natively rather than through writing them inside SQL syntax, with triple advantage that:
- it's more readable
- it avoids unnecessary serialization
- it prevents SQL injection
In your example, the concept of value doesn't exist. All you have is an undefined part of an URL
I surely know what preparedstatement does I’ve used it in 500 lines of db code
and that example was to demonstrate, what should be replaced
Basically like split
And yet you're saying things that suggest you don't understand the point
Without splitting it
It was to explain what I would like to do if you don’t have an answer or just want to spread negative energy stfu and don’t reply
An answer to what? SQL and URL are not similar. What exists with one doesn't have to exist with the other, and here it doesn't look like it does
The only thing setString does is replace a placeholder with a specified string and I would like to do the exact same thing with urls
That's not at all what it does, but at least you explained what you want
I don't think there is such a thing anywhere, but you could try and use String.format()
Ok I’ll try tomorrow if it doesn’t work and no one got anything else I might just stick with split
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.