This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I just wanted to post this here to see if someone else had run across this, or to help someone who is going to. Here's what I'm doing on a .jsp page in JRun (windows 2000 install) < %@ page import="javax.naming.*, javax.rmi.PortableRemoteObject, java.sql.*, javax.sql.*, java.io.*, javax.servlet.*, javax.servlet.http.*" % > < %<br /> Connection m_connection = null;<br /> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();<br /> m_connection = DriverManager.getConnection("jdbc dbc:TestingCams;user=XXXXXXXXX;password=XXXXXXXXX");<br /> String query = "SELECT ID, NAME, TITLE, ADULT, FORMAT, CATEGORY, URL from TestCams";<br /> Statement statement = m_connection.createStatement();<br /> ResultSet resultSet = statement.executeQuery(query);<br /> String title = "Title";<br /> while (resultSet.next())<br /> { %> < %=resultSet.getString("ID")%> < %=resultSet.getString("NAME")%> < %=resultSet.getString("URL")%> < %}%>
I know it's a bit hodge-podge, but here's the weird part. If instead of naming the colums in the SQL statement I use the 'SELECT * from' version, the resultSet won't let me access the columns by string (and this is the _really_ weird part) EXECEPT for the FIRST column... strangest damned thing... [Ajith inserted spaces after the < tag so that the code appears as text and not get interpreted by UBB as code! ] [This message has been edited by Ajith Kallambella (edited June 12, 2001).]
Ryan Alexander
Greenhorn
Joined: May 23, 2001
Posts: 8
posted
0
Oh dear! Mea culpa for the formatting error, and thanks much Ajith! -ryan
Bjarki Holm
Author
Ranch Hand
Joined: May 25, 2001
Posts: 65
posted
0
Yes, this is strange. But it's always a better practise to explicitly name the columns you're selecting, so this could be easily avoided ------------------ Bjarki Holm Author of Professional Java Data
Bjarki Holm
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.