pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: Sudarvizhi-L (@Sudarvizhi-L) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3763: Driver does not implement setURL() and getURL() methods
Date: Thu, 14 Aug 2025 11:57:33 +0000
Message-ID: <[email protected]> (raw)
When using PreparedStatement.setURL(int, url) and ResultSet.getURL(url) with the PostgreSQL JDBC driver, the method throws SQLFeatureNotSupportedException stating it is not yet implemented. This makes it impossible to insert URL objects directly via the JDBC setURL and getURL method.
**Driver Version**
org.postgresql:postgresql:42.7.7
**Java Version**
OpenJDK 21
**OS Version**
Windows 11
**PostgreSQL Version**
PostgreSQL 17.5
**To Reproduce**
Steps to reproduce the behaviour:
1. Create a table with a text column for URLs.
2. Try inserting a java.net.URL using PreparedStatement.setURL(...).
3. Observe that SQLFeatureNotSupportedException is thrown.
```java
import java.net.URL;
import java.sql.*;
public class UrlSample {
public static void main(String[] args) throws Exception {
String jdbcUrl = "jdbc:postgresql://localhost:5432/sampledb";
String user = "user";
String pass = "password";
try (Connection conn = DriverManager.getConnection(jdbcUrl, user, pass)) {
String createTable = "CREATE TABLE IF NOT EXISTS url_table (id SERIAL PRIMARY KEY, url_column VARCHAR(255))";
try (Statement stmt = conn.createStatement()) {
stmt.execute(createTable);
}
String insertSql = "INSERT INTO url_table (url_column) VALUES (?)";
try (PreparedStatement pstmt = conn.prepareStatement(insertSql)) {
URL sampleUrl = new URL("https://github.com/techatpark/rdbms-olap-practice";);
pstmt.setURL(1, sampleUrl); // <-- Causes SQLFeatureNotSupportedException
pstmt.executeUpdate();
}
String selectSql = "SELECT id, url_column FROM url_table";
try (Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(selectSql)) {
while (rs.next()) {
int id = rs.getInt("id");
URL urlValue = rs.getURL("url_column");
System.out.println("Row " + id + ": " + urlValue);
}
}
}
}
}
```
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3763: Driver does not implement setURL() and getURL() methods
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox