netbeans下javaDB的使用和table bind



昨天做了个小型的数据库管理系统,主要是用于管理货物的进出和统计
使用MySQL和java作的,由于是帮其他不会编程的人写的毕业设计,于是今晚打算用jdk里面自带的javaDB
来实现一下,方正比较简单,争取2个小时拿下。
hoho~~~

昨天晚上做的太失败了,作了一晚,哎。。。十分垃圾
刚才花了下时间看了下help
oh,my God,我真是个苦命的孩子,居然花大量的劳动力去写
本来可轻松搞定,真是社会的进步阿
自己跟不上了,人老了。。。

首先看了下javaDB, 连是连上了,但加奇怪的是Drivers用不了,
什么都没错吗,真是的。。。
哎,原来是重装netbeans后点击保留配置的结果。
因为安装glassfish-v2ur2来代替了以前的glassfish-v2,这样以来路径就不对了
当然驱动的jar包就Error了,自然就不可以使用了,于是配置了下就ok了。

虽说ok,但是Java DB(Embedded)connection  has some problems

废话不说了,现在开始狂建数据库吧。首先把那5张表搞定
oh,出现问题拉。。。
Java DB中建的表正错了杂就删不了阿,呵呵,重启就ok了,原来是我先把文件给删除了。。。


shit
connect
2008-5-12 12:39:01 org.jdesktop.application.Application$1 run
严重: Application class repertorysys.RepertorySysApp failed to launch
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b23-fcs (02/28/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'add, fax, phone, connect, name, remark FROM business' at line 1
Error Code: 1064
Call: SELECT bid, add, fax, phone, connect, name, remark FROM business
Query: ReportQuery(repertorysys.Business)
        at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:319)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:566)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
        at oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSession.java:473)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:285)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:615)
        at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2416)
        at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllReportQueryRows(ExpressionQueryMechanism.java:2382)
        at oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(ReportQuery.java:802)
        at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
        at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:692)
        at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:746)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2248)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:924)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:367)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:478)
        at repertorysys.RepertorySysView.initComponents(RepertorySysView.java:201)
        at repertorysys.RepertorySysView.<init>(RepertorySysView.java:29)
        at repertorysys.RepertorySysApp.startup(RepertorySysApp.java:19)
        at org.jdesktop.application.Application$1.run(Application.java:171)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'add, fax, phone, connect, name, remark FROM business' at line 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.Util.getInstance(Util.java:381)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:726)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:501)
        ... 29 more
Exception in thread "AWT-EventQueue-0" java.lang.Error: Application class repertorysys.RepertorySysApp failed to launch
        at org.jdesktop.application.Application$1.run(Application.java:177)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b23-fcs (02/28/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'add, fax, phone, connect, name, remark FROM business' at line 1
Error Code: 1064
Call: SELECT bid, add, fax, phone, connect, name, remark FROM business
Query: ReportQuery(repertorysys.Business)
        at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:319)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:566)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
        at oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSession.java:473)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:285)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:615)
        at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2416)
        at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllReportQueryRows(ExpressionQueryMechanism.java:2382)
        at oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(ReportQuery.java:802)
        at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
        at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:692)
        at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:746)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2248)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:924)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:367)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:478)
        at repertorysys.RepertorySysView.initComponents(RepertorySysView.java:201)
        at repertorysys.RepertorySysView.<init>(RepertorySysView.java:29)
        at repertorysys.RepertorySysApp.startup(RepertorySysApp.java:19)
        at org.jdesktop.application.Application$1.run(Application.java:171)
        ... 8 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'add, fax, phone, connect, name, remark FROM business' at line 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.Util.getInstance(Util.java:381)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:726)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:501)
        ... 29 more

一堆异常,而且把插入的table bind删了还是不行,恢复历史版本也不行,把我折腾残了,于是只能不断的新建工程,大量的劳动力被浪费了
后来发现原来可以有ctrl+z就ok了,
可一把table绑定好date就有抛异常哦
经过一宿的折腾,终于发现是database建的有问题,
表中的列用了关键字,在MySQL中建的时候没有发现,因为没有任何的异常现象。。。

真是晕死。。。。
大概是因为里面用了引号,而bind中是没有的吧。。。
不过还是因为自己,乱用什么关键字阿。
这个bug解决后,参照自动生成的代码,就很快搞定了,

下面还要帮00写下他家的种子系统。。。
呵呵,不知道我四娘需不需要化肥管理系统阿???

不过都是一类系统了。。。

哎。要考软设了,还没看阿
想起上次的成绩就欲哭无泪,自己没看。。。不过下午考试看不看都一样,,,
这次还是要好好的复习了。。。

还有四级。更是晕阿,考了2次。。。
以后要好好规划我的生活了。。。
早上看哈英语和日语
下午浏览哈网页,写哈程序。。。
晚上看软设。。。

that's all


你可能感兴趣的:(mysql,exception,server,table,application,Netbeans)