工作时编译JDBC程序我正在此错误我在日食得到一个错误的JDBC
程序代码同时:
public static void main(String[] args) {
Connection conn=null;
Statement stat=null;
ResultSet rs = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/cricket","root","root");
stat = ((java.sql.Connection) conn).createStatement();
rs = stat.executeQuery("SELECT Cric_id,Cric_name,Normal_Skilla,Special_Skill,Other_Skill FROM indian");
while(rs.next())
{
int id = rs.getInt("Cric_id");
String name = rs.getString("Cric_name");
String normal = rs.getString("Normal_Skills");
String special = rs.getString("Special_Skill");
String other = rs.getString("Other_Skill");
System.out.println(id +"\t"+name+"\t"+normal+"\t"+special+"\t"+other);
}
}catch(Exception e)
{
System.out.println("Error:"+e);
}
finally
{
if(conn != null)
try{
conn.close();
}catch(Exception ig)
{
System.out.println("ERROR2:"+ig);
}
}
}
}
错误:
Exception in thread "main" java.lang.NoClassDefFoundError: JDBC1 (wrong name: jdbc1)
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
我使用Eclipse IDE任何人都可以看到它到底在哪里我错了
什么是类的名字和你是如何调用该程序? – Vikdor