statement « mysql « Java Database Q&A

1. can not issue data manipulation statements with executeQuery()

in mysql i have two tables


col1   col2  SIM1 ..........col24
a       x     1        ...

2. Is there a good way to execute MySQL statements atomically via JDBC?

Suppose I have a table that contains valid data. I would like to modify this data in some way, but I'd like to make sure that if any errors occur with ...

3. Can not issue data manipulation statements with executeQuery in java

I'm trying to insert records in mysql database using java, What do I place in this code so that I could insert records:

String id;
   String name;
   String ...

4. statement.getGeneratedKeys() and MySQL

I've learned it the hard way that last_insert_id in mysql is not pool-safe. i.e. if you are pooling connections, you'll get messed up insert_ids. How does java's statement.getGeneratedKeys() get the key ...

5. JDBC multiple statements in prepatedStatement?

I am currently using preparedStatements to do selects in my web app. I need to do this:

SET ...

6. What's wrong with my JDBC mySQL statement? Apparently my WHERE clause is messed

What's wrong with my JDBC mySQL statement? Apparently my WHERE clause is messed up. Note: the first value is defined in the actionListener and the = value is the variable ...

7. problem with prepare statement

I wrote this query but it has a error.

 String x = String.valueOf(jTable1.getModel().getValueAt(row, 2) );

    try {
        PreparedStatement preparedStatement1 = connection.prepareStatement("select ...

8. problem with prepare statement

preparedStatement = connection.prepareStatement("select fname,lname, "
                    + "sportman_code,start,finish,salary,amount,number,pnumber "

9. retreiving data from mysql select statement in java

Having trouble with this..I'm sure I'm missing something simple but I simply want the result of a select statement in a java mysql select statement but I keep getting:

Here's my code:
PreparedStatement ...

10. Using multiple statement objects in a multi-threaded application

Im developing a multi-threaded application in which different threads are required to update the database concurrently. Hence,i passed a new statement object to each thread, while creating it(to avoid locking,if i ...

11. no operation allowed after statement is closed. Java, Mysql

I have this code:

public void saveGPSReading(GPSReader gpsRd){

String sql="INSERT INTO EventData(" +
        "accountID," +
        "deviceID," +

12. fast retrieval of SELECT statement with GPS coordinates in MySQL

I have a table in MySQL db which two of it's columns are the latitude and the longitude of a given geo-point. it's defined as Float(2,6). I want to select only the ...

13. Designing an account statement

I have a mySQl innodb database which has a couple of tables which store different kind of transactions of a user. In order to show a custom 'Account Statement', I have ...

14. doubt in select statement in mysql database

Hi, As a beginner, this may be a silly question. Please bear with me. I have a table with around 12 columns and the primary key an "id" being a sequential number statrting from 1, 2.. etc and the last column status of int type 0 or 1. (mySql databse) I have to select one row whose status is 0 and ...

16. Union of mysql statement

17. MySql select statement

Hi All, I have java application which suppose to connect to MySql server and print the selected data. The application has 4 combo boxes (first item is empty): Name, Customer, Supplier, Status. User could choose any of these options. So there are huge number of select combinations. Is it possible to create one select statement template something like this: PreparedStatement stmt ...