Message-ID: From: "Sudarvizhi-L (@Sudarvizhi-L)" To: "pgjdbc/pgjdbc" Date: Thu, 14 Aug 2025 11:57:33 +0000 Subject: [pgjdbc/pgjdbc] issue #3763: Driver does not implement setURL() and getURL() methods List-Id: X-GitHub-Author-Id: 113355561 X-GitHub-Author-Login: Sudarvizhi-L X-GitHub-Issue: 3763 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: closed X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3763 Content-Type: text/plain; charset=utf-8 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); } } } } } ```