我的程序出错了

时间:2016-11-30 07:44:11

标签: java

C:\Users\PRAVEEN\Desktop>javac afterlogin.java
afterlogin.java:20: cannot find symbol
symbol  : class Connection
location: class afterlogin
                        Connection z=DriverManager.getConnection("jdbc:mysql://localhost:3306/db","root","root");
                        ^
afterlogin.java:20: cannot find symbol
symbol  : variable DriverManager
location: class afterlogin
                        Connection z=DriverManager.getConnection("jdbc:mysql://localhost:3306/db","root","root");
                                     ^
afterlogin.java:21: cannot find symbol
symbol  : class PreparedStatement
location: class afterlogin
                        PreparedStatement ps=z.PreparedStatement("insert into reg(fn,ln,pwd,email,mob)values(?????)");

1 个答案:

答案 0 :(得分:2)

您应该在afterLogin.java上进行导入,以解决在编译过程中遇到的这些错误。以下是您需要添加的导入。

import java.sql.Connection;
import java.sql.DriverManager;

您发布的编辑错误也不完整。如果您不熟悉JDBC编程,我建议您遵循特定的教程。有大量文章可以指导您完成此过程。