row « mysql « Java Database Q&A





1. How can I find out how many rows a MySQL query returns in Java?    stackoverflow.com

How can I find out how many rows a MySQL query returns in Java?

2. How to insert and update multiple rows to Sql database with same query?    stackoverflow.com

I have counter for unique column in my table. Now I have list where I have column name (which is unique) and counter (which contains some integer value). I know that ...

3. How to ensure that only table row will be created with a particular state?    stackoverflow.com

I have a domain object that looks something like this:

class UserStuff 
{
    String userid;
    boolean primordial;
}
In the table, primordial is a TINYINT. A User can ...

4. Is this the correct way to sort rows which have the same insert datetime?    stackoverflow.com

When I execute a query from my application (Java JDBC), it is returning the row with seq 83 first. But I want the row with seq 84.

seq   |  ...

5. JDBC, MySQL: getting back row data from PreparedStatement executes    stackoverflow.com

I'm using the following setup:

public MySQLProcessWriter(Connection con) throws SQLException { 
 String returnNames[] = {"processId","length","vertices"};
 addresser = con.prepareStatement("INSERT INTO addressbook (length, vertices, activity) VALUES (?, ?, ?)", returnNames);
}
processId corresponds to an ...

6. Problem with adding rows with JDBC and MySQL?    stackoverflow.com

I'm using JDBC in sync with MySQL to add and define rows to a MySQL database's Table. The problem is that I don't know why it is throwing an Exception when ...

7. How to retreive row in DB Table just added now in Java    stackoverflow.com

Table id int(11) No auto_increment Change ...

8. JDBC always tests the last row of MySQL table?    stackoverflow.com

I have a Manager class that saves data in the SQL table and also get result from SQL table and test these data.when I run my program,one frame will be shown ...

9. mysql: find rows which have a field that is a substring of "string"    stackoverflow.com

is there a way to write an sql query that finds all rows where the field value is a substring of a given string. Example:

table names

Name      | ...





10. is there any limit on the number of rows one can select in MySQL?    stackoverflow.com

There are 1652487 rows in my table in MYSQL. I want to copy all the values corresponding to one field into a file. I wrote a java program in netbeans using ...

11. get value from updated row    stackoverflow.com

I'm trying to get the new rating from an UPDATE statement in java

int userID = 99;

String sql = "UPDATE table SET rating=rating+1 WHERE user_REF="+userID;
statement.executeUpdate(sql);
I can just do another SELECT statement, but ...

12. In MySQL, how do I insert only when row doesn't exist and update only when existing version is less    stackoverflow.com

I am looking for a way to only insert when the row does not exist in MySQL, and update when the row exists AND the version of the existing row is ...

13. Read rows from a mysql table via java    stackoverflow.com

I need sample code to read rows of data from a mysql table using java

14. Ibatis queryWithRowHandler() still seems to fetch all rows    stackoverflow.com

I'm using Ibatis 2.3.4 and Mysql 5.1.37, with mysql-java-connector 5.1.6 with java 1.6 I have query that returns very many rows from a single table. In order to do this the manual ...

15. java.sql.SQLException: Column count doesn't match value count at row 1    stackoverflow.com

I'm trying to update values using JDBC and I continue to get the same error for different tables and with different schemas. Let's say that I have a table like this

+----------------+-------------+------+-----+---------+-------+
| Field ...

16. SQL row insert into a table + keys into its linking table within one statement (many-to-many relationship)    stackoverflow.com

Hey, I'm used to ORM so I have huge absence of sql experience. I want to know what is the best way to insert a row into a table, that is ...





17. SELECT then UPDATE all rows from RESULTSET    stackoverflow.com

I am wanting to update all the rows in the RESULTSET from the SELECT in one single UPDATE query. Here is what I have come up with so far:

SELECT id_queue, status FROM ...

18. Java: Insert multiple rows into MySQL with PreparedStatement    stackoverflow.com

I want to insert multiple rows into a MySQL table at once using Java. The number of rows is dynamic. In the past I was doing...

for (String element : array) {
 ...

19. Getting index of inserted rows from a MySQL database    stackoverflow.com

I'm using Java (jdbc) to interact with a MySQL database. I have table with a primary index which is AUTO INCREMENT. When I insert a row, I need to get the ...

20. Prepared statement for MySQL so that it would pick a row containing the highest Timestamp for column that would be greater from given parameter?    stackoverflow.com

How to write a Java prepared statement for MySQL so that it would pick a row containing the highest Timestamp value from a column that would be greater from given parameter? ...

21. Reading full rows in Java ResultSet    stackoverflow.com

I know there are similar questions to this one, but I haven't found any answer anywhere. For some reason ResultSet has no function to read the full row to a String ...

22. Changing foreign key results in new row    stackoverflow.com

i´m currently working on my first Java application based on a MySQL DB. I´m using EclipseLink2.0 and NetBeans, at the time i am facing a behaviour i cannot explain, maybe someone ...

23. ResultSet behavior with MySQL database, does it store all rows in memory?    stackoverflow.com

When returning results from a select query, does the ResultSet store all of the rows in memory? Or does it only fetch a limited amount of rows? Does it differ ...

24. How to get an automatically incremented column value when inserting a row into a table in mysql using java?    stackoverflow.com

How can I insert into table1 like: INSERT INTO table1 (description) VALUES ('Some test description here'); and have it return the automatically incremented ID so that I can then insert a ...

25. How to compare two rows or get the fields which value is not match with the rows that compared?    stackoverflow.com

I'm trying to get the fields which value is not match base on the compared rows. It's hard to explain so I'll put the sample table and its results. Table: orders

|  ...

26. How to understand if a row has been queried by a select query previously?    stackoverflow.com

At my application there is a table and I am inserting new rows that table. There is a Java class that gets a row(by a select query) from that table and ...

27. How to get first row from ResultSet from query    stackoverflow.com

How to get first row from ResultSet from query ( Java MySQL ) ? I know how to iterate but how to get just first row ?

28. mysql java: insert a row with some parametres don't work    stackoverflow.com

I try to execute this request

window.requete ="INSERT INTO logfile VALUES(" + omsg.get_Creator() +","+ omsg.get_CreatorParent() +","+ omsg.get_SequenceNumber()+ ","+omsg.get_CreatorCost()+ ","+omsg.get_CreatorEnergy()+","+interval+","+lplinterval+ ","+omsg.get_Data()+"," + tmp2+")";

try { Statement stmt = window.connexion.createStatement();
    int ...

29. Cannot add or update a child row: a foreign key constraint fails    stackoverflow.com

Anybody know what's wrong with my code? I am using a simple INSERT statement (as opposed to the regular PreparedStatement because I am trying to utilize mySQL's AES_ENCRYPT/DECRYPT functions. ...

30. JDBC statement fails to delete row in specific MySql table    stackoverflow.com

I have a table, say example1 and I'm using a jdbc statement to delete one of its rows. I have tried various methods, from delete from example1 where id = 1 ...

31. mySQL query, merge two rows and add another colum as output result    stackoverflow.com

i want to merge two rows and add a column to show the count of similar rows. I don't want to update the table, i just want this as ...

32. Rows that are similar in all but one column    stackoverflow.com

I'm not sure what this is called but it happens all the time that you get a resultset like:

(id,name,age,favorite)
0,John Smith,21,Pepperoni 
1,John Smith,21,Ham
2,John Smith,21,Olives
3,John Doe,54,Tomatoes
4,John Doe,54,Potatoes 
Now when you're iterating over this ...

33. com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect date value: '' for column 'Date_Of_Birth' at row 1    stackoverflow.com

I'm trying to update the personal detail of a user through a java panel.Panel has fields like user_id(autogenerated),name,date of birth. problem is when i enter nothing to the date of birth field ...

34. Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails    stackoverflow.com

I'm practicing the affablebean e-commerce tutorial, but I'm stuck in a error trying to persist data through mySQL workbench, this is the error I'm getting.

Error Code: 1452. Cannot add ...

35. what is the better way to store a single record against multiple rows in mysql    stackoverflow.com

Hi I am new to mysql and java aswell. I want to store a jpeg files and hash values of small chunks of file. I have stored the hash values of ...

36. Java MySQL get last row    stackoverflow.com

So I'm having issues with my program. Basically this far the program is like a MySQL based chat. It stores messages in database and reads them. Im having problems with the ...

37. Pass in variable length lists of foreign keys as arguments to a stored procedure via JDBC and then use the lists to insert rows into a table    stackoverflow.com

I need to construct a single transaction / stored procedure that takes in two lists of foreign keys and inserts new rows into a table from those foreign keys. Specifically, I have ...

38. select same value from N rows in a mysql database    stackoverflow.com

I m new to mysql and m trying to select N rows from a mysql table in eclipse. Now, i want to select N rows of same value from the database. ...

39. MySql query returns wrong result list: the first row is repeated    forums.netbeans.org

MySql query returns wrong result list: the first row is repeated NetBeans Forums -> NetBeans Platform Users View previous topic :: View next topic Author Message Andre Uhres Joined: 19 Oct 2008 Posts: 3 Posted: Thu Sep 23, 2010 8:29 am ...

40. Row count in MySQL    coderanch.com

41. exclusive row level lock in MySql    coderanch.com

42. howto get total of rows from mysql    coderanch.com

43. MySQL get the row number    coderanch.com

44. mysql multiple rows and hashmap    coderanch.com

Hi all, I have been working japer reports within java. I have developed a report using jdbc in ireport. Now, I want to execute this report within my java programme. I am exporting this report in a .pdf file using, JasperPrint print = JasperFillManager.fillReport(jasperFileName, map, conn); Now, here is a little trouble. I have already generated report in ireport including headers ...

46. ModelFacade / Java / MySQL / localhost / get error: list table rows    dbforums.com

type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: javax.el.ELException: Error reading 'claims' on type com.webhomecover.beans.ClaimCollection org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.el.ELException: Error reading 'claims' on type com.webhomecover.beans.ClaimCollection javax.el.BeanELResolver.getValue(BeanELResolver.java:66) javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53) org.apache.el.parser.AstValue.getValue(AstValue.java:118) org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) org.apache.jasper****ntime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:925) org.apache.jsp.listclaims_jsp._jspx_meth_c_005fforEach_005f0(listclaims_jsp.java:125) org.apache.jsp.listclaims_jsp._jspService(listclaims_jsp.java:99) org.apache.jasper****ntime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause java.lang.NullPointerException com.webhomecover.dao.ClaimDAO.readClaims(Unknown Source) com.webhomecover.model.ModelFacade.getClaims(Unknown ...

47. Counting rows in a mysql query    forums.oracle.com

Stop wanting to know the number of rows, is the easiest way to deal with this question. The only reason you need to know the number of rows is that you are putting your data into an array. So stop using arrays and use a List, for which you don't need to know the size in advance. If this "DefaultTableModel" is ...

49. Unable to get rows from MYSQL database    forums.oracle.com

JTable tMovie; JMenuBar menu; JMenuItem List; JMenuItem New; JMenuItem Change; JMenuItem Delete; JMenuItem Om; DefaultTableModel tableMovie; Connection connection = null; public void init(){ this.setLayout(new BorderLayout()); //Menu menu = new JMenuBar(); JMenu menu1 = new JMenu("File"); JMenu menu2 = new JMenu("Help"); List = new JMenuItem("List movies"); New = new JMenuItem("New movie"); Change = new JMenuItem("Change movie"); Delete = new JMenuItem("Delete movie"); Om ...

50. Best way to get a random row in a db (mysql)    forums.oracle.com