Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda