I tried to access to the MS access database by the following code (JSP file).
Please let me know how to solve this problem.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc
dbc:telephone");
java.sql.Statement statement = connection.createStatement();
Enumeration parameters = request.getParameterNames();
if(parameters.hasMoreElements()) {
String lastvalue = request.getParameter("lastParam");
String firstvalue = request.getParameter("fisrtParam");
String phonevalue = request.getParameter("phoneParam");
statement.executableUpdate(
"INSERT INTO tellist (\"Last Name\", \"First Name\", \"Phone\") VALUES
('"+lastvalue+"','"+firstvalue+"','"+phonevalue+"')");
}
java.sql.ResultSet columns = statement.executeQuery(
"SELECT * FROM tellist");
while(columns.next()) {
String last = columns.getString("Last Name");
String first = columns.getSting("First Name");
String phone = columns.getString("Phone");
< tr> < td> last < /td>
< td> first < /td>
< td> phone < /td>
< /tr>
}
However, the error message I got is the follwing.
I do not kow even why I got this message. It seems that it does not recognize the driver.
org.apache.jasper.JasperException: Unable to compile class for JSPD:\jakarta-tomcat-3.2.3\work\localhost_8080\_0002ftak_0002ejsptak_jsp_0.java:71: String not terminated at end of line.
"INSERT INTO tellist (\"Last Name\", \"First Name\", \"Phone\") VALUES
^
D:\jakarta-tomcat-3.2.3\work\localhost_8080\_0002ftak_0002ejsptak_jsp_0.java:72: ')' expected.
('"+lastvalue+"','"+firstvalue+"','"+phonevalue+"')");
^
D:\jakarta-tomcat-3.2.3\work\localhost_8080\_0002ftak_0002ejsptak_jsp_0.java:72: Invalid character constant.
('"+lastvalue+"','"+firstvalue+"','"+phonevalue+"')");
^
D:\jakarta-tomcat-3.2.3\work\localhost_8080\_0002ftak_0002ejsptak_jsp_0.java:72: Invalid character constant.
('"+lastvalue+"','"+firstvalue+"','"+phonevalue+"')");
^
D:\jakarta-tomcat-3.2.3\work\localhost_8080\_0002ftak_0002ejsptak_jsp_0.java:72: Invalid character constant.
('"+lastvalue+"','"+firstvalue+"','"+phonevalue+"')");
^
D:\jakarta-tomcat-3.2.3\work\localhost_8080\_0002ftak_0002ejsptak_jsp_0.java:72: String not terminated at end of line.
('"+lastvalue+"','"+firstvalue+"','"+phonevalue+"')");
[This message has been edited by Carl Trusiak (edited July 24, 2001).]
The html embedded in his code really caused some problems with UBB. I removed the scrpting indicators(They where right) and modified the html tags with a space after the < to allow things to appear right.
[This message has been edited by Carl Trusiak (edited July 24, 2001).]