Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
get values from another Java class

I want to get doktor[0], doktor[1], secilenBolum from RandevufiltreSorgu.java. I created object of RandevufiltreSorgu class in randevusec. But when I run the query, I am not able to obtain the values I want. There is no inheritance in use. What can I do?

public class randevusec {
    Connection conn = null;
    PreparedStatement ps = null;
    ResultSet rs = null;

    public ResultSet saatler() throws SQLException, Exception {
        randevufiltreSorgu nesne = new randevufiltreSorgu();
        try {
            Class.forName("org.postgresql.Driver");
            conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/tipmerkezivt", "postgres", "2569");
            ps = conn.prepareStatement(
                    "WITH Q1 AS(\n" + "    select * from doktor natural join bolum where dr_adi='" + nesne.doktor[0]
                            + "' and dr_soyadi='" + nesne.doktor[1] + "' and bolum.b_adi='" + nesne.secilenBolum + "'\n"
                            + "    )\n" + "    select cs_saat from doktorun_programi natural join Q1\n" + "    ",
                    ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
            rs = ps.executeQuery();
            return rs;
        } catch (Exception e) {
            throw new Exception("Bağlantı başarısız!");
        }

        finally {
            conn.close();
        }
    }
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It is very hard to understand your code because it is mostly in foreign language, but what you can do is when you construct doktor[0] and doktor[1], put the keyword public static before them.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!