0

I followed the below procedure--

  1. Create a JFrame that holds your Jtable...

  2. From Pallete click and drag Jtable to the JFrame.

. Click Jtable to be selected and right click then choose bind -> elements then click.

  1. Window for binding jtable will popup. click import data from button. Select new connection for connection string is not set in the selection and click. Select the driver name according to your chosen database.

  2. Fill-up neccessary data according to machine configuration. Then click ok. window popup that display your connection and selection of table to be bind in jtable. Then click ok and wait for data to import.

6.From Left portion of the window are those fields that are available and from the right are fields that are selected to view in the jtable. Then click ok and compile and run your program...

but i m getting the following error--

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 '-yourpersonalhealthcarepartner.patient_master' at line 1
Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Error Code: 1064
Call: SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master
Query: ReadAllQuery(referenceClass=PatientMaster sql="SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master")
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 '-yourpersonalhealthcarepartner.patient_master' at line 1
Error Code: 1064
Call: SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master
Query: ReadAllQuery(referenceClass=PatientMaster sql="SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master")
    at org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:378)
    at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260)
    at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469)
    at SymCarePackage.User.initComponents(User.java:33)
    at SymCarePackage.User.<init>(User.java:18)
    at SymCarePackage.User$2.run(User.java:136)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.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 '-yourpersonalhealthcarepartner.patient_master' at line 1
Error Code: 1064
Call: SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master
Query: ReadAllQuery(referenceClass=PatientMaster sql="SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master")
    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)
    ... 18 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 '-yourpersonalhealthcarepartner.patient_master' at line 1
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
    at com.mysql.jdbc.Util.getInstance(Util.java:408)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:1007)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:642)
    ... 38 more

Please help me out to resolve the above problem

The problem is i need to change the query and i dont know how to change the query.do you guys know how to change that??

C A Anusha
  • 37
  • 7
  • see if you can run the generated query `SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master` directly from `mysql` shell. – Shubham Chaurasia Feb 08 '17 at 12:41
  • Possible duplicate of [What is a stack trace, and how can I use it to debug my application errors?](http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors) – perissf Feb 08 '17 at 12:48
  • i m not able to run SELECT pid, age, did, gender, pname FROM symcare-yourpersonalhealthcarepartner.patient_master from mysql shell. i m getting error 1064 i.e, syntax error. @ShubhamChaurasia if i write in this form-- SELECT pid, age, did, gender, pname FROM patient_master then it is working properly. – C A Anusha Feb 09 '17 at 14:43
  • @CAAnusha though this is about hibernate but this thread may help http://stackoverflow.com/questions/2224503/creating-field-with-reserved-word-name-with-jpa – Shubham Chaurasia Feb 09 '17 at 17:01
  • if u watch this video you may get to know which method i followed to bind the jtable with database,here's the link-- https://www.youtube.com/watch?v=gGpcmgqSk9U – C A Anusha Feb 11 '17 at 07:22
  • https://youtu.be/G4JeKZ6nDUI?list=PL50gsvefI0U77Rrbeb9yfVXenk3h2gjhE this will help out – Muhammad Ali Apr 27 '22 at 20:52

0 Answers0