Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Column in field list is ambiguous error

843859Oct 27 2005 — edited Oct 27 2005
i am using jdbc in my program with a query statement that retrieve holdingsID by querying different tables. when i run the program it has an error saying
Column HoldingsID in field list is ambiguous, what does this mean? How can i solve it?
here is my code, included is my sql select statement please check it.
        String key=request.getParameter("key");   
		Connection conn = null;
		String[][] a=new String[10][3];		
		int r=0;
		String qstr="";
		ResultSet rs=null;           
          try{      
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		conn = DriverManager.getConnection("jdbc:mysql://localhost/scitemp?user=scinetadmin&password=A1kl@taN");
		Statement stmt=conn.createStatement();
	  	qstr="SELECT DISTINCT HoldingsID FROM tblHoldings, tblHoldingsAuthorName," +
                     "tblHoldingsSubject, tblHoldingsPublisherName"+
        	     " WHERE (tblHoldings.Title LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR "+ 
  		     "(tblHoldings.Contents LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
	  	     "(tblHoldingsAuthorName.AuthorName LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
	 	     "(tblHoldingsSubject.SubjectHeadings LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
 		     "(tblHoldingsPublisherName.PublicationDate = "+"'"+key+"'"+")"+ 
                     " ORDER BY HoldingsID";						 
		rs  = stmt.executeQuery(qstr);
		while ( rs.next() && r <10) { 				 
				a[r][0]=rs.getString("HoldingsID");	
				a[r][1]="1";
				a[r][2]="SILMS";   
				r++; 	
			 }
          }catch(Exception e){out.println("error:"+e.getMessage());}
-----
thanks in advance for your help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2005
Added on Oct 27 2005
5 comments
506 views