Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6797927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:40:08+00:00 2026-05-26T18:40:08+00:00

I’m a new member. I have been struggling with sqlitejdbc, I thought. I made

  • 0

I’m a new member. I have been struggling with sqlitejdbc, I thought.
I made a query to sqlite database from a java program.I got above exception.
My query is

select * 
from (  person as p 
        inner join company as c on p.p_id=c.p_id
     ) 
     inner join contact as ct on p.p_id=ct.p_id 
 where p.p_id=?;

When I put the query on navicatLite editor by placing p.p_id=’1′ instead of p.p_id=? , I was fine. It showed me correct values.

But from my java program. I got this exception.

Exception in thread "main" java.sql.SQLException: no such column: p.p_id
        at org.sqlite.DB.throwex(DB.java:288)
        at org.sqlite.NativeDB.prepare(Native Method)
        at org.sqlite.DB.prepare(DB.java:114)
        at org.sqlite.PrepStmt.(PrepStmt.java:37)
        at org.sqlite.Conn.prepareStatement(Conn.java:231)
        at org.sqlite.Conn.prepareStatement(Conn.java:224)
        at org.sqlite.Conn.prepareStatement(Conn.java:213)
        at programTest.test.main(test.java:19)
Java Result: 1

I’m sure there exists the person table and p_id field. I’ve searched this kind of question on this site but I found the one which is related to ruby on rails, not java. I have no idea what’s wrong.

My java program is

import java.sql.*;

/**
 *
 * @author Htet 101
 */
public class test {

    public static void main(String[] args) throws Exception {
        Class.forName("org.sqlite.JDBC");
        Connection conn =
                DriverManager.getConnection("jdbc:sqlite://C://Users//Htet 101//Documents//addressbook.s3db");
        PreparedStatement stat = conn.prepareStatement("select * from (person as p inner join company as c on p.p_id=c.p_id) inner join contact as ct on p.p_id=ct.p_id where p.p_id=?;");
        stat.setInt(1, 1);

        ResultSet rs = stat.executeQuery();
        while (rs.next()) {
            System.out.print("Name : " + rs.getString("p_name") + " ");
        }
        rs.close();
        conn.close();
    }
}

I’m developing it using NetBeans 6.9.1, SQLite 3.7.8, SQLiteJDBC v056.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:40:09+00:00Added an answer on May 26, 2026 at 6:40 pm

    I’m not absolutely sure, but I think it should work if you remove brackets from From :
    select * from
    person as p
    inner join company as c on p.p_id=c.p_id
    inner join contact as ct on p.p_id=ct.p_id where p.p_id=?;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.