jass
June 21st, 2004, 08:27 AM
Hello to everyone. First of all, I'm definitely new to a programming world. Thanks in advance for helping me.
I'm trying to retrieve a data (type =text) from a BLOB column by using java code in JSP. I got an internal error () . There is no error in the coding but I'm not sure if the code is working or not.
The internal error is;
java.lang.UnsupportedOperationException
at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4417)
Following is my full coding code:
<%@ page contentType="text/html; charset=iso-8859-1"
language="java" import="java.sql.*, java.io.*" %>
<%
// DB connection to ARCDOC
java.sql.Connection con;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:arcdoc","myusername","mypassword");
// SQL statement (Query 1)
String query = "select T_DORIS from arcdoc.provenance where DORIS_KEY = '762'";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
boolean rs_isEmpty = !rs.next();
boolean rs_hasData = !rs_isEmpty;
Object rs_data;
int rs_numRows = 0;
%>
<HTML>
<BODY>
<%
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(rs.getBlob("T_DORIS").getBinaryStream()));
String line = reader.readLine();
while (line != null) {
line = reader.readLine();
%>
<%=line %>
<%
}
} catch(SQLException sqe) {
} catch (IOException ioe) {
} finally {
rs.close();
stmt.close();
con.close();
}
%>
</BODY>
</HTML>
If there any better or much more flexible way of obtaining the data, please let me know. Can e-mail me personally for discussion as well (freda_henry@yahoo.com)
I'm trying to retrieve a data (type =text) from a BLOB column by using java code in JSP. I got an internal error () . There is no error in the coding but I'm not sure if the code is working or not.
The internal error is;
java.lang.UnsupportedOperationException
at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4417)
Following is my full coding code:
<%@ page contentType="text/html; charset=iso-8859-1"
language="java" import="java.sql.*, java.io.*" %>
<%
// DB connection to ARCDOC
java.sql.Connection con;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:arcdoc","myusername","mypassword");
// SQL statement (Query 1)
String query = "select T_DORIS from arcdoc.provenance where DORIS_KEY = '762'";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
boolean rs_isEmpty = !rs.next();
boolean rs_hasData = !rs_isEmpty;
Object rs_data;
int rs_numRows = 0;
%>
<HTML>
<BODY>
<%
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(rs.getBlob("T_DORIS").getBinaryStream()));
String line = reader.readLine();
while (line != null) {
line = reader.readLine();
%>
<%=line %>
<%
}
} catch(SQLException sqe) {
} catch (IOException ioe) {
} finally {
rs.close();
stmt.close();
con.close();
}
%>
</BODY>
</HTML>
If there any better or much more flexible way of obtaining the data, please let me know. Can e-mail me personally for discussion as well (freda_henry@yahoo.com)