H
Hugh Mandeville
Hi,
psql, it shows the values.
Is there something I have to do in JSP to get the inet value?
I have a simple table in PostgreSQL 7.4.7 that contains a column named
"ip_address" of type "INET".
PostgreSQL Table
Column | Typ | Modifiers
-------------+----------+-----------------------------------------------------
id | integer | not null default
nextval('public.host_id_seq'::text)
ip_address | inet |
Results of Select in pgsql
# select id, ip_address from host;
id | ip_address
----+------------
1 | 127.0.0.1
2 | 127.0.0.1
(2 rows)
JSP Script
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Test JSTL, SQL and PostgreSQL's INET type.</title>
</head>
<body>
<sql:query var="rs" dataSource="jdbc/postgres">
SELECT id, ip_address
FROM host
</sql:query>
Row Count = ${rs.rowCount}<p>
<c:forEach var="row" items="${rs.rows}">
id = ${row.id}, ip_address = ${row.ip_address}<br>
</c:forEach>
</body>
</html>
JSP Output
Row Count = 2
id = 1, ip_address =
id = 2, ip_address =
I have no problem getting columns of other types, like character,
integer, or timestamp. It is only with inet.
Thanks -Hugh
INET column, it returns empty string. If I do the same select fromFrom a JSP page (Tomcat 5.0.28), when I try to get the values of an
psql, it shows the values.
Is there something I have to do in JSP to get the inet value?
I have a simple table in PostgreSQL 7.4.7 that contains a column named
"ip_address" of type "INET".
PostgreSQL Table
Column | Typ | Modifiers
-------------+----------+-----------------------------------------------------
id | integer | not null default
nextval('public.host_id_seq'::text)
ip_address | inet |
Results of Select in pgsql
# select id, ip_address from host;
id | ip_address
----+------------
1 | 127.0.0.1
2 | 127.0.0.1
(2 rows)
JSP Script
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Test JSTL, SQL and PostgreSQL's INET type.</title>
</head>
<body>
<sql:query var="rs" dataSource="jdbc/postgres">
SELECT id, ip_address
FROM host
</sql:query>
Row Count = ${rs.rowCount}<p>
<c:forEach var="row" items="${rs.rows}">
id = ${row.id}, ip_address = ${row.ip_address}<br>
</c:forEach>
</body>
</html>
JSP Output
Row Count = 2
id = 1, ip_address =
id = 2, ip_address =
I have no problem getting columns of other types, like character,
integer, or timestamp. It is only with inet.
Thanks -Hugh