Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JSP to Access

Status
Not open for further replies.

shennanigan83

Programmer
Joined
Oct 24, 2003
Messages
3
Location
PH
hello there! i'd just like to ask if anyone can tell me the syntax for connecting JSP to MS Access with Tomcat 4 as the web server. I've tried the syntax:

<%
Class.forName(&quot;com.sun.jdbc.odbc.Driver&quot;).newInstance();
java.sql.Connection con = java.sql.DriverManager.getConnection(&quot;jdbc:odbc:dane&quot;);
java.sql.Statement statement = con.createStatement();
String results = &quot;Select * from table_dane&quot;;
java.sql.ResultSet rows = statement.executeQuery(results);

While(rows.next()) {
String Uname = rows.getString(&quot;username&quot;);
String Pwd = rows.getString(&quot;password&quot;); %>

<TR> <TD><%= Uname %></TD>
<TD><%= Pwd %></TD>
</TR>

<% } %>

but i am encountering this error that says a missing ';' is expected in While(rows.next()) {

when i put a semi-colon there, tomcat can't find the java.sql.* class. if i try jdbc.sql.* it also doesn't work.

Can anyone please help me? thank you so much in advance!!!
 
i think its while(rows.next()) and not While(rows.next())...

Known is handfull, Unknown is worldfull
 
I know nothing about jsp, but in java I would put the closing brace } at the end of the third line :

while(rows.next()) {
String Uname = rows.getString(&quot;username&quot;);
String Pwd = rows.getString(&quot;password&quot;); } %>

 
nothing to do with the semi colon, your code is right, there is only a typo. in line

While(rows.next())

&quot;W&quot; should be in lower case.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top