Subject: [pgjdbc/pgjdbc] issue #3763: Driver does not implement setURL() and getURL() methods

From: "Sudarvizhi-L (@Sudarvizhi-L)" <[email-masked]>
Date: Thu, 14 Aug 2025 11:57:33 +0000

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);
                }
            }
        }
    }
}
```

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Thu, 14 Aug 2025 14:48:21 +0000

Perfectly legitimate to throw a NotSupported Exception as there is no way to implement this in PostgreSQL https://docs.oracle.com/en/java/javase/17/docs/api/java.sql/java/sql/PreparedStatement.html#setURL(int,java.net.URL)