当使用
我们有这样一个问题,即表的命名将使用引号“。这是因为底层实现并不真正知道使用什么方言,从而导致与MSAccess不兼容。这就导致了例如@table(name=”\“employee\”“)
这样的表注释。
为了解决这个问题,我们必须在orm.xml中包含:
...
<persistence-unit-defaults>
<delimited-identifiers />
</persistence-unit-defaults>
...
现在,普通查询可以工作,但在命名查询中使用JPQL将失败,因为结果SQL查询将引用所有列名:
[EL Warning]: 2019-06-02 21:14:27.818--UnitOfWork(2144282958)--Thread(Thread[main,5,main])--Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 unexpected token: Personen Error Code: -5581 Call: SELECT "PersonId", "EMail", "Ansprechpartner", "Briefanrede", "Fax", "Name", "Ort", "PLZ", "Sortierung", "Straße", "Telefon" FROM "Personen" Query: ReadAllQuery(name="Personen.findAll" referenceClass=Personen sql="SELECT "PersonId", "EMail", "Ansprechpartner", "Briefanrede", "Fax", "Name", "Ort", "PLZ", "Sortierung", "Straße", "Telefon" FROM "Personen"") at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:682) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558) at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002) at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:299) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:694) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2738) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2691) at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:495) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1168) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899) at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1127) at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1215) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1751) at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258) at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469) at de.mebrach.jungebuehne.vorverkauf.PersonenService.loadAll(PersonenService.java:20) at Main.main(Main.java:20) Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 unexpected token: Personen
在persistence.xml中包含trget-database属性:
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.AccessPlatformDelimiterConfig"/>
向类路径添加新类:
package org.eclipse.persistence.platform.database;
public class AccessPlatformDelimiterConfig extends AccessPlatform {
private static final long serialVersionUID = 7034590043310425678L;
public AccessPlatformDelimiterConfig() {
super();
this.tableQualifier = "";
this.startDelimiter = "[";
this.endDelimiter = "]";
}
}
我有一个Access数据库。此数据库包含表和存储的查询。我的目标是使用Java Ucanaccess(一个JDBC连接器)来使用存储在Access文件中的数据,并用JasperSoft创建报告。 对正常表的查询工作: 但问题是我在Access中有使用其他查询的对象。因此,当我试图调用查询时,它不起作用: 例如,“rqt_storeded”包含: 该查询可以在Access中工作,但不能在Java中工
如有任何帮助,不胜感激。谢谢你。
问题内容: 我只想获取一个表“ b”的值,如果表“ a”的值是“-”如果表“ b”的值是空的,那么即使它是“-”,也要获取表“ a”的值 Microsoft Access对以下查询说“ Missing operator”: 我认为该错误是在CASE表达式行上。 问题答案: MS Access不支持语句。用途: 我不确定Access是否支持别名,但是它可能支持 注意(尽管标签正确),问题的标题可能会
如何将Crystal Reports与ucanaccess jdbc驱动程序一起使用?我得到“未找到驱动程序”错误。我将ucanaccess jar文件复制到程序文件(C:\program files(x86)\Business objects\common\3.5\java)中的业务对象,编辑了crconfig.xml文件,并且已经在Crystal Reports中配置了JDBC(JNDI)。M
问题内容: 最终用户(开发人员或生产人员)可以推荐一个Sql驱动程序包,最好使用“ database / sql”包。我对Postgres,ODBC,MySql(以及可能用于高容量的其他商品(即,不是Sqlite)的其他商品)感兴趣,这些商品最好可在Windows和/或Linux(最好同时使用)上使用。令我感兴趣的是,它可能需要最近进行了更新/维护,并且必须与最新的Go版本一起使用。效率(吞吐量)
我试图使用NetBeans内置的数据库服务系统和UCanAccess JDBC驱动程序连接到MS Access数据库。在从service面板拖放表以将它们连接到Swing GUI中的JTables之后,一切似乎都正常工作,但是,当我试图运行该程序时,我会出现以下错误: 在查看了该错误之后,我认为这很可能是连接错误,但是在创建连接时没有显示任何错误,并且在services选项卡中,所有表都正确显示: