Thimo
10-29-2002, 10:18 AM
<%
// load driver
Class.forName("org.gjt.mm.mysql.Driver");
// pass database parameters to JDBC driver
Connection Con = DriverManager.getConnection("jdbc:mysql://localhost/MovieXpress?user=root&password=root");
// query statement
Statement SQLStatement5 = Con.createStatement();
Statement SQLStatement6 = Con.createStatement();
%>
<%
// select movietitles from cathay
ResultSet rs5 = SQLStatement5.executeQuery("SELECT DISTINCT MovieTitle FROM cathay");
// insert all the movietitles from cathay into a table
while(rs5.next()) {
String cathay_movie = rs5.getString("MovieTitle");
ResultSet rs6 = SQLStatement6.executeQuery("INSERT INTO combine (MovieTitle) VALUES ('"+cathay_movie+"')");
}
%>
hi, wat's the problem wif this code?
the error message that i got is: java.lang.NullPointerException
// load driver
Class.forName("org.gjt.mm.mysql.Driver");
// pass database parameters to JDBC driver
Connection Con = DriverManager.getConnection("jdbc:mysql://localhost/MovieXpress?user=root&password=root");
// query statement
Statement SQLStatement5 = Con.createStatement();
Statement SQLStatement6 = Con.createStatement();
%>
<%
// select movietitles from cathay
ResultSet rs5 = SQLStatement5.executeQuery("SELECT DISTINCT MovieTitle FROM cathay");
// insert all the movietitles from cathay into a table
while(rs5.next()) {
String cathay_movie = rs5.getString("MovieTitle");
ResultSet rs6 = SQLStatement6.executeQuery("INSERT INTO combine (MovieTitle) VALUES ('"+cathay_movie+"')");
}
%>
hi, wat's the problem wif this code?
the error message that i got is: java.lang.NullPointerException