• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jdbc:odbc issue under JRun

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh dear! Mea culpa for the formatting error, and thanks much Ajith!
-ryan
 
Author
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic