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
JavaBot
JavaBot9mo ago
This post has been reserved for your question.
Hey @netty.bootstrap! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Kyo-chan
Kyo-chan9mo ago
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
netty
nettyOP9mo ago
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
Kyo-chan
Kyo-chan9mo ago
And yet you're saying things that suggest you don't understand the point
netty
nettyOP9mo ago
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
Kyo-chan
Kyo-chan9mo ago
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
netty
nettyOP9mo ago
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
Kyo-chan
Kyo-chan9mo ago
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()
netty
nettyOP9mo ago
Ok I’ll try tomorrow if it doesn’t work and no one got anything else I might just stick with split
JavaBot
JavaBot9mo ago
💤 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.

Did you find this page helpful?