public void sqlData() throws ClassNotFoundException, SQLException
{
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection con = DriverManager.getConnection("jdbc:ucanaccess://path;
String qry = "SELECT Patient.NAME AS patient, Patient.DISEASE AS
disease FROM Patient, Doctor WHERE
Patient.DISEASE=Doctor.SPECIALIZATION";
try{
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(qry);
DefaultTableModel model = (DefaultTableModel)appoint_table.getModel();
int x =1;
while(rs.next())
{
String rrr = rs.getString("patient");
System.out.println(rrr);
}
}
catch(SQLException e)
{
System.out.println(e);
}
}
Asked
Active
Viewed 715 times
0

Mark Rotteveel
- 100,966
- 191
- 140
- 197
-
when i run this code, this error is occur:- " net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 unexpected token: DAY" – muhammad bilal Jun 01 '19 at 07:45
-
1When asking about an exception, always post the actual code that causes the exception (your code wouldn't compile), and the exact and complete stack trace of the exception (replace `System.out.println(e);` by `e.printStackTrace()`, or better, don't catch the exception) – JB Nizet Jun 01 '19 at 15:57
1 Answers
0
It is unlikely that your posted code will throw that exception, but I try to answer while assuming way too much details to do it correctly. Anyway...
I assume:
- you are using JPA
- you set
delimited-identifiers
- you also are using EclipseLink as implementation.
If so, do as follows:
Include a target-database entry in persistence.xml:
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.AccessPlatformDelimiterConfig"/>
Add a new class to your classpath:
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 = "";
}
}

Marvin Emil Brach
- 3,984
- 1
- 32
- 62