ColdFusion, AJAX and web...
<cfquery datasource="cfartgallery" name="qArtists">
SELECT *
FROM artists
ORDER BY lastname, firstname
</cfquery>
<cfoutput query="qArtists">
ID: #qArtists.artistid#<br/>
Last name: #qArtists.lastname#<br/>
First name: #qArtists.firstname#<br/>
<br/>
</cfoutput>
Java code
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:odbc:artgallery");
Statement smnt = conn.createStatement();
ResultSet res = smnt.executeQuery("SELECT * FROM artists " +
"ORDER BY lastname, firstname");
while(res.next())
{
System.out.println("ID:" + res.getInt("artistid"));
System.out.println("Last name:" + res.getString("lastname"));
System.out.println("First name:" + res.getString("firstname"));
System.out.println();
}
conn.close();
}
catch (SQLException se)
{
System.out.println("SQLException: " + se.getMessage());
}
catch (Exception e)
{
System.out.println("Exception: " + e.getMessage());
}
You have looked at ASP haven't you?
-
Scott.
By Darryl Lyons, at 4/21/2005 06:59:00 pm
Not recently. Do you mean, ASP is pretty similar, or?
Looking at an example from W3CSchools.com:
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("/db/northwind.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Customers", conn
do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br />")
next
Response.Write("<br />")
rs.MoveNext
loop
rs.close
conn.close
%>
So easy with Coldfusion, right? Try to make a select over a table with 1 milion rows (or much less).. Good by coldfusion..
[]s
Why would you want to return one million rows to a client app?
That's bad programming no matter what language you're using. Most DBAs would shoot you.