M
M
Masteron2016-01-18 19:30:27
MySQL
Masteron, 2016-01-18 19:30:27

Mysql, select and java?

there is a request:

Boolean b;
statement.execute("SELECT LOGIN FROM testtable WHERE LOGIN='Admin'");

if the string "Admin" is in the table then the variable b becomes true otherwise false.
How to implement?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor Alenkov, 2016-01-18
@Borz

Boolean b = statement.executeQuery("SELECT EXISTS (SELECT * FROM testtable WHERE LOGIN='Admin' LIMIT 1)").getBoolean(1);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question