[英]netbeans java database application
The setup of my app: 我的应用程序的设置:
and the error that is thrown: 和引发的错误:
Hello, I am pretty new to java and netbeans. 您好,我对Java和Netbeans很陌生。 I previously worked on Adobe Flash. 我以前使用过Adobe Flash。 I am having this problem where error of db or table not found is being thrown. 我在抛出未找到数据库或表的错误的地方遇到了这个问题。 If anybody could makeout anything from the screenshots attached, Please help me. 如果有人可以从随附的屏幕截图中识别出任何内容,请帮助我。 I am trying to use the derby.jdbc.EmbeddedDriver here to store data. 我试图在这里使用derby.jdbc.EmbeddedDriver来存储数据。
Below is the entire code. 以下是整个代码。
package loginapp;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
public class Loginapp {
public static void main(String[] args) {
// TODO code application logic here
try
{
chkLogin();
}
catch(Exception e){
e.printStackTrace();
}
}
private static void chkLogin() throws Exception{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
Connection conn = DriverManager.getConnection("jdbc:derby:testdb;create=true");
Statement stmnt = conn.createStatement();
ResultSet results = stmnt.executeQuery("select * from USERLOGIN");
ResultSetMetaData rsmd = results.getMetaData();
int numCols = rsmd.getColumnCount();
for(int i=0;i<=numCols;i++)System.out.print(rsmd.getColumnLabel(i)+"\t\t");
}
}
Have included derby.jar in my library and the "jdbc:derby:testdb;create=true [user1 on APP]" points to the db. 在我的库中包含了derby.jar,并且“ jdbc:derby:testdb; create = true [APP上的user1]”指向数据库。 Am able to update when I do it from the SQL window. 从SQL窗口执行更新时能够更新。
Thank you 谢谢
Three common reasons for "table does not exist" when you think you've already created the tables: 当您认为已经创建表时,“表不存在”的三个常见原因:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.