The code looks ok, you haven't closed any of the JDBC Objects, so you will
run out shortly. Why are you synchronizing on a local variable, there
should not be a reason to do this. Have you tried rs.getString(1)?
Are you sure you're flushing and closing the output stream so that the data
actually gets transfered to the browser? It could be that you are properly
generating the page, but never sending it. You don't want to use the
jdbcOdbc bridge if you can help it, and with Oracle you have two other, much
more attractive, options. There is the OCI driver which requires the
Oracle OCI drivers to be installed on each client, or the thin drivers that are
100% pure java and don't require any other software to be installed or
configured on the client. You can get either or both at
www.oracle.com.
----- Original Message -----
Sent: Wednesday, September 22, 1999 7:42
AM
Subject: ResultSet not giving up
data
Firstly, let me show my code
snippet:
--------------------------------------------------------------------------------------------------
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:msoracle", "vahps",
"manager");
stmt =
con.createStatement();
PreparedStatement pstmt =
con.prepareStatement("SELECT systemid FROM user_pass WHERE username = ? AND
password = ?");
synchronized (pstmt)
{
pstmt.clearParameters();
pstmt.setString(1,
name);
pstmt.setString(2,
passwd);
rs =
pstmt.executeQuery();
while (rs.next())
{
testvalue =
rs.getString("systemid");
out.println ("System ID: " + testvalue +
"<BR>");
}
}
}
catch (ClassNotFoundException e)
{
out.println ("Cannot connect to
db<BR>");
out.println (e.getMessage()
+ "<BR>");
}
catch (SQLException e)
{
out.println ("SQLException caught: " +
e.getMessage());
}
--------------------------------------------------------------------------------------------------------------
The line in bold should
display the variable 'testvalue', even if it's just one row
of data returned. And, as you may have guessed it's not working........ Can
anyone tell me what I can do to fix this. I am connecting to an Oracle DB
using the jdbc-odbc driver from Microsuck. Which I think is the culprit.......
What do you think?
Antonio