Inner Join mutiple tables with error in row when input data - Java

  •  | 
  •   ( words)


Previously i have posted question regarding inner join into multiple table. and most probably the SQL inner join code is not a problem.

rsTry = stmtTry.executeQuery(

"SELECT * FROM (User Inner Join CPU On User.SN = CPU.SN) Inner Join Software on CPU.SN = Software.SN");

Here is the code to store in database

    rsTry.updateString(1, jtfSN.getText());
    rsTry.updateString(2, jtfName.getText());
    rsTry.updateString(3, jtfDepartment.getText());
    rsTry.updateString(4, jtfHostname.getText());
    rsTry.updateString(5, jtfModel.getText());
    rsTry.updateString(6, jtfBrand.getText());
    rsTry.updateString(9, jtfMsOffice.getText());
    rsTry.updateString(10, jtfMsVisio.getText());

My table Design

User - SN | Name | Department
CPU - Hostname | Model | Brand | SN
S/w - SN | MsOffice | MsVisio

i have no problem with inner join 2 tables and manage to update data as well. but when inner join 3 tables once i try to submit the data it will pop out

ava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(
at sun.jdbc.odbc.JdbcOdbc.standardError(
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(
at sun.jdbc.odbc.JdbcOdbcStatement.execute(
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(
at testing.NewJFrame.testingJoint(
at testing.NewJFrame.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(
at javax.swing.AbstractButton$Handler.actionPerformed(
at javax.swing.DefaultButtonModel.fireActionPerformed(
at javax.swing.DefaultButtonModel.setPressed(
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$200(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

BUILD SUCCESSFUL (total time: 3 seconds)

No correct solution


Problem Solved

For example -

Table A | Username(PK)| Address|

Table B | ID | Phone | Username(FK)|

Table C | SN | Brand | Model | Username(FK)

rs = st.executeQuery

("SELECT * FROM (A Inner Join B on A.Username = B.Username) Inner Join C on A.Username = C.Username");

if anyone looking for inner join 3 tables together by Using JAVA and Link to Access use the referenece above.

Make sure you must link the table relationship in Access before run the java program if not it will pop out "ERROR IN ROW"

Thanks everyone who helping me :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow