I cannot figure out why i have this error.It may just be a missing semicolon but i can't find where.
Here is my code:(error occurs in many lines, so i can't show where exactly is the problem)

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
/*
* producer.java
*
* Created on Nov 29, 2011, 7:45:09 PM
*/
package producers;

/**
*
* @author dimitros
*/

public class producer extends javax.swing.JFrame {
Connection con;
Statement stmt;
ResultSet rs;
/** Creates new form producer */
public producer() {
initComponents();
DoConnect();

}

public void DoConnect( ) {
try{
String host="jdbc:oracle:thin:@oraserver.in.cs.…
String uName="dchris04";
String uPass="mgHkCUW";
con=DriverManager.getConnection(host,uNa…


stmt = con.createStatement();
String sql="select * from producer";
rs = stmt.executeQuery(sql);

rs.next();
int Producer_ID=rs.getInt("Producer_ID");
String ID=Integer.toString(Producer_ID);
String First=rs.getString("Producer_First_Name"…
String Last=rs.getString("Producer_Last_Name");
String Compressed=rs.getString("Compressed_Name…

txtProducer_ID.setText(ID);
txtProducer_First_Name.setText(First);
txtProducer_Last_Name.setText(Last);
txtCompressed_Name.setText(Compressed);

}
catch(SQLException err){
JOptionPane.showMessageDialog(producer.t… err.getMessage());
}

}
}

Your error message sounds like a mismatched pair of {}s.

Look at the lines before the line number of the first error message.

String host="jdbc:oracle:thinoraserver.in.cs.…
con=DriverManager.getConnection(host,uNa…
String First=rs.getString("Producer_First_Name"…
String Compressed=rs.getString("Compressed_Name…
String First=rs.getString("Producer_First_Name"…
String Compressed=rs.getString("Compressed_Name…
JOptionPane.showMessageDialog(producer.t… err.getMessage());

either this is your code, and you shouldn't be wondering why you are getting errors, or, you've replaced parts of your code by putting ... to hide variable names or ... whatever, for us. by this, you also may have overwritten the line where the error occurs, so how do you expect us to see anything clear in there?

I'm also pretty sure your compiler is giving you a bit more information than just 'Java: error: class, interface, or enum expected'
could you paste the complete error message, so we know where to look?

This article has been dead for over six months. Start a new discussion instead.