aspose file tools*
The moose likes JDBC and the fly likes jdbc:odbc issue under JRun Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc:odbc issue under JRun" Watch "jdbc:odbc issue under JRun" New topic
Author

jdbc:odbc issue under JRun

Ryan Alexander
Greenhorn

Joined: May 23, 2001
Posts: 8
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
Oh dear! Mea culpa for the formatting error, and thanks much Ajith!
-ryan
Bjarki Holm
Author
Ranch Hand

Joined: May 25, 2001
Posts: 65
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
 
 
subject: jdbc:odbc issue under JRun