mysql 2 « mysql « Java Database Q&A

Java Database Q&A
7.Data Type
9.Database Product
25.MS Access
39.stored procedure
Java Database Q&A » mysql » mysql 2 

1. Dealing with concurrency issues at the database level

How would you go about dealing with multiple users accessing a database record concurrently, specifically if you have an instrument reservation table and you wish to prevent two users reserving the ...

2. Parsing CSV-like data for use with JDBC

How would I generate the output in Java with regex, split, or tokenizing? I need to remove the spaces around words and the commas between the words. I want to store ...

3. Populating database via jdbc

In the below code, values are inserted manually: 13 and Aman. But what I am doing is reading a file and then till the completion of the file, I am inserting ...

4. Java persistence, communications between db entities and other models

I'm using the TopLink persistence library with the MySQL db in my Java applications. I've developed the class library which is used by several desktop applications, it contains some classes that are ...

5. Java graphic 2D library to draw ER diagrams?

I'm looking for a Java 2D graphics library to draw a E-R Diagram from a MySQL database, anyone know something like that?

  • With a 2D Java library graphic I need to draw ...

6. How Implement My Idea in protege

I just now Say the problem domain. I have some collection of words words are below

Algoithms,Sorting,Tree Sorting
The above words to be stored in protege. How to store and retrive from ...

7. Where to add the UTF-8 extension in the HTML page?

I need to add the charset="utf-8" at the end of the script tags to get the translation to another language done. I don know where all I should add the tags. ...

8. Where can I download source for MySQL Connector/J

Googling didn't help

9. java- mysql data retriving problem

import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.*;
import java.awt.*;
import javax.swing.table.*;
import java.util.Vector;

public class SimpleTable extends JFrame {
public SimpleTable() {
super("Simple JTable Test");
setSize(350, 200);
int ColCount;
int i;


    Connection con=DriverManager.getConnection("jdbc:mysql://localhost/employ_details","root","");

10. MAC osx, change datadir mysql, still not working

Hi i am tearing my hair out at this one, i am a noob ill admit when it comes to mysql, i had ir working perfectly on my local Mac HD, ...

11. Java application to make database dump

I needing to make a backup from my database in MySQL, with schema anda data. Anyone does know how or have some tips? Thanks


I want to select the first row in a table, order by time (ascending), then delete that row. I don't want to use two queries since there's a possibility that another ...

13. Store BigInteger into Mysql

Due to mathematica constraints I've to use the BigInteger class to represent values. After some calculations I would like to store the result (given by 2x BigInteger instances) into Mysql... What is the ...

14. jruby jdbcmysql adapter does not work with ssl?

I cannot seem to get jdbcmysql to run over ssl. Downloaded gems: jdbc-mysql (5.0.4) jruby-openssl (0.7.1) Using a normal rails console (not jruby), I got it to run with (sanitized below):

cp = ActiveRecord::Base.establish_connection(
  :adapter ...

15. How download/upload contacts from/to mysql database using j2me

I'm developing mobile application which will be able to download/upload mobile phone book contact from MySQL database which is stored on the web. I need to get all the numbers, name, ...

16. Get the next ID not used?

Currently I have a database that is not managed by me and I can't do any changes to it, the id field is a smallint 2 unsigned that gives you up ...

17. LinkedList with Serialization in Java

I'm getting introduced to serialization and ran into some problems when pairing it with LinkedList Consider i have the following table:


18. how to write a file in classpath using netbeans and java!!! not to able to access it

test_database.jdbc.url = jdbc:mysql://localhost:3306/test_database
test_database.jdbc.driver = com.mysql.jdbc.Driver
test_database.jdbc.username = username
test_database.jdbc.password = password

new > other > other >  Properties file
so plz can anyone teach me how to write the poperties file in correct classpath ...

19. MySQL field type

  `USER_ID` bigint(20) NOT NULL auto_increment,
  `USER_ABOUT_YOU` varchar(255) default NULL,
  `USER_COMMUNITY` tinyblob,
  `USER_COUNTRY` varchar(255) default NULL,
  `USER_GENDER` varchar(255) default NULL,

20. what is META-INF/persistence.xml in netbeans?

I am building a semester Java project that relies on DB, so I read tutorials about JDBC and I built simple app that reads from a MySQL DB. I tried Netbeans ...

21. Value gets changed upon comiting. | CallableStatements

I having a weird problem with a DAO class and a StoredProcedure, what is happening is that I use a CallableStatement object which takes 15 IN parameters, the value of the ...

22. Ping a MySQL server

Is there a specific method in Java that checks whether a MySQL server is alive or not?

23. Java scalability question

I am a Java developer, and I am finding a solution to scale my new application. I have the principal application like a directory of my clients and a lot of ...

24. General JDBC Setup

So I have a MySQL database set up on a Debian server and it works fine from a phpMyAdmin client. I'm currently working on a project to write a Java server ...

25. jdbc mysql giving me NumberFormatException

I am trying to connect to a remote mysql database but I get the following error

java.sql.SQLException: Cannot connect to MySQL server on Is
here a MySQL server running on the machine/port ...

26. Benefits or using XML over MySQL and vice-versa?

I am currently working on a project that was not made by me but it makes use of a lot XML files instead of MySQL in place of it. Because of that ...

27. MySQL JDBC over SSL problem

How one can make MySQL JDBC work over SSL (with X509 certificates validation)? I've got self-created certificates as described in MySQL manual, in Using SSL for Secure Connections, specifically:

# Create ...

28. Connector/J depends on

I wanna research mysql-connector-java depends on .so files Do you know that mysql-connector is pure java?

29. is creating a unique html file for each article a good practice?

sorry for poor topic name, i could not think for any thing better ;) i am working on a news broadcast web site project, and the stake holder asked me to create ...

30. making apache lenya work with mysql

I am new to java ... As per the documentation of apache lenya It doesnot use db by default but it can be configured to use db.. can anyone suggest a ...

31. Guava / Voldemort / MySQL flushing to DB issue

Does anyone have experience when using Guava in front of voldemort (with the mysql storage option on the back-end) I have in-depth experience with MySQL but voldemort and guava are quite ...

32. How many tiers do you need?

We have a web-app that consists of web-tier (PHP), app-tier (Java) and DB (mysql). web-tier communicates with app-tier AND with DB to retrieve some data. One of our clients insists on separating each ...

33. Respond to a get request in java using a database

I'm trying to respond to a get request in java using a database. But it throws some error which I don't know a clue how to fix it.

import java.sql.Connection;
import java.sql.DriverManager;
import ...

34. Using a ticket server to generate primary ids?

I am building a distributed application on top of Java and Cassandra. To generate unique sequential 32bit & 64 bit Ids, does an approach like using Flickr's ticket servers ...

35. Rich Text issue with Java Web Application

Could someone guide me understand how to implement Rich Text functionality in Java based Web application. I am using Xinha for WYSIWYG HTML editor and I am having MySql data type ...

36. RESTful MySQL / Terminology / Passing Parameters / Returning Ints & Doubles

So, in an attempt to create a RESTful frontend to a MySQL database, I've briefly looked at phprestql (easy & simple, but just too simple) and now I'm attempting to build ...

37. How to scroll through mysql database in java

I'm trying to scroll over all the contents of a database. How do I properly do this:

conc conclass = new conc();
        Connection conn = ...

38. Service usage limiter implementation

I need to limit multiple service usages for multiple customers. For example, customer customer1 can send max 1000 SMS per month. My implementation is based on one MySQL table with 3 ...

39. MySQl 5.5 doesn't truncate VARCHARs when they're longer than expected

I've this problem: before 5.5 mySQL (using myISAM tables) used to truncate VARCHAR types to the column length. Now, starting with the abovementioned version, it doesn't anymore. It's a huge problem ...

40. Java - Trouble Parsing Data Returned From Database

I have a query string that is dynamic. The items I am searching for in the database are based upon what the user selects in a checkbox on an html form. ...

41. How to restore a MySQL dump file by Java?

I backup my MySQL databse to a specific folder, say, d:\backup\ by a webpage. The backup goes without issues, but I am not able to restore it using the following command.

Runtime.getRuntime().exec("mysql ...

42. Problem on setting classpath of mysql.jar with java program on Mac os

I have a java program which I want to run on Mac os. I have problem in setting classpath of jre and mysql.jar. If I set classpath for 'mysql-connector-1.15.0-bin.jar', its displaying exception of ...

43. How to deploy a project in netbeans and define the db in mysql for it in ubuntu?

I have deployed a project but haven't deployed the mysql DB yet . How do I do that for it to work ? And also what changes have to be done ...

44. jdbc4.CommunicationsException: Communications link failure

Did someone face such an error happening in case of some queries execution? (jdbc4.CommunicationsException: Communications link failure) Generally, this exception means some problem of communication between application and mysql. And you can ...

45. What is the easiest way to create a simple client for MySQL?

In our curriculum new students with a little programming experience in Java will learn how to design and use a MySQL-database. What is the easiest way for them to create a ...

46. When working with objects that are saved to a database that have a relationship, do you load the whole objects or just the id?

Suppose I have a CatHerder and he has Cats, when I getCatHerderByID(String id) should I load in the CatHerder and set an arrayList of cats or an arrayList of catIDs? ...

47. Java database question homework problem

I have to write a Java program that creates a Car table with car manufacturers, models, model years, and fuel efficiency ratings. Insert several cars. Print out the average fuel efficiency. ...

48. Ping MySQL Server Using JDBC

This seems rather simple (not for me)... How does one ping a mysql server using the JDBC? i have successfully used select and insert queries with JDBC and MySQL, but how to ...

49. convertion of mysql database data into RSS feed using java

How do I convert the data stored in MySQL table into RSS feed using java program.

50. iReport variable incrementor usage with list component

I have a typical MySQL report listing one 'Item' per page. One of the fields is min_price. I would like to have my detail band list a fixed number ...

51. How to use the not clause with select

In the following query:

query = "SELECT * FROM racetimes WHERE course='" + myracecoursevariable + "'";
I want to change the query and select data from database where the course is not equal ...

52. how to build jar file from my project?

I wrote a program with java and mysql and now i want to have a jar file that when i click on it the program work(without that mysql install on my ...

53. how to add mysql db to my project?

I write a program with netbeans. I connect my program to mysql an use from db that I made in mysql and it work correct. Now I create .jar file from my project ...

54. Check mysql database state periodically from java

I am new to this MySQL concepts.i want to check the MySQL database periodically whether its working properly or not from java.Is there any simple way to check this. Thanks In Advance. ...

55. Simple open source Java SE Mysql client

I have a simple application that would use large matrices and I wanted to show matrices operations on some (Excel sheet looking) frame, I was wondering if there are easy to ...

56. to draw graph with mysql data

I need to draw a line graph with mysql data which has two columns. some one help me with a sample code.

57. Need some help!

Sorry, this question might sound silly, but I need some help! My project is to open a directory and list all the files. These are csv files. Each file is opened and ...

58. Orbeon forms and mysql: JDBC naming context problem

I am trying to set up orben forms with mysql. I've been following these steps: -Created schema "Orben" with the associated user "Orbeon" -Donwloaded the mysql java jdbc connector and stored it in ...

59. how to get list of Databases "Schema" names of MySql using java JDBC

how to get list of Databases "Schema" names of MySql using java JDBC ?

60. how to check for database schema existence in MYSQL using JDBC?

Possible Duplicate:
how to get list of Databases “Schema” names of MySql using java JDBC
how to check for database schema existence in MYSQL using JDBC ...

61. Master slave replication jdbc url

We have a MySQL setup with one master and two slaves we use Spring 3.0 to connect to the DBs and mysql-connector-java-5.1.13.jar. We also use commons dbcp 1.4 for connection pooling. We ...

62. problem with utf8 in java

I have the following table:

create table test
  fname char(20) character set utf8 collate utf8_turkish_ci,
  id int primary key
I am inserting data as follows:
resultSet.executeQuery("set namee utf8");
preparedStatement = connection.prepareStatement("insert into test(fname) ...

63. What field type should I use for fixed width number?

I have a field in my object that is required to be fixed width and only numeric. It will hold values such as 0002, 0103, or 1212. Currently, I have my ...

64. Whats my hostname on my local MySQL server?

I just set up a MySQL server on my PC for testing Java with JDBC. At the moment "localhost" works perfectly as hostname for my applications, when running them on the same ...

65. problem with like

 preparedStatement = connection.prepareStatement("select fname,lname, "
                + "sportman_code

66. Manipulating audio files in java/mysql

How to store audio files to MYSQL DB from a java servlet... Please Help

67. breaking out of a loop logic in Java

I'm learning Java and just started playing around with mysql and am having a bit of a problem with some logic that worked in python and I'm having trouble converting. I basically ...

68. Java file hash for identifying identical files

I would like to get the hash of files (mostly video files) independent of external properties such as path and file name. I'll be needing to store hash in a database ...

69. problem with bit in mysql

resultset = statemet.executequery("select shift+0 from sportman");

string x = resultset.getstring("shift");
but second line throw exception:
Column 'shift' not found.
shift is bit(8) and i want to show it to form '000101'.

70. How do I get persistence with AKKA for MySQL using the Java API?

Since the AKKA persistence module has been deprecated, how can I use AKKA with MySQL using the Java API?

71. return mysql thread_id

Whenever I connect to mysql using command prompt, It returns a thread_id (64 in this case). Is it possible to get this number using Java (preferred) or PHP?

# mysql -h10.10.10.10 -uroot -proot@123
Welcome ...

72. Implement Database(MySQL) in a Restlet application

I'm building a restlet webservice with lots of connections(1000 users) from the clients to a MySQL database.

  1. Should I use a framework like Hibernate to handle data(I figure I could hack out ...

73. SSH tunneling with JDBC on Mac OS X - Problems

I am currently developing a java application that uses JDBC inorder to connect to MySQL on a computer running Mac OS 10.6.7. The server that I connect to suddenly decided to ...

74. Re-serializing JBPM process variables directly via MySQL

I'm working with an application that uses JBPM 3.1 and MySQL. The core problem is that there are processes instances with variables that contain an older version of an external, ...

75. how to sort mysql two different values?

I have 2 Tables and i join them. I have a special_id field, if the special_id field is > -1 then they should be printed out before the ones with special_id < ...

76. Communication failure during handshake. Is there a server running on localhost:3306?

I've just upgraded my server to Suse 11.4 & I'm using MySQL 5 & Java 6 and systinet as my web server.
When I try to log in my application I can't ...

77. Java mysql read modify write

Is there a way in Java using MySQL connector, I can perform a read modify write atomically, i.e., I want to perform this:

// pseudocode
   r = getRecord();

78. Is there a proper way to instantiate strongly typed objects in DAOs?

I'm trying to determine which is the right way to code a DAO for a class that contains a few primitive data types, and three strongly typed objects which have DAOs ...

79. How to uniquely identify the same user across multiple websites?

I'm doing an advertising network as a project for BS degree. I;m trying to identify the same user across multiple websites. I have a USER table in my database with ID ...

80. Difference between MySQL workbench and mysql-connector-java-5.1.15

I am trying to run the following sql script on a mysql server through an ant task using mysql-connector-java-5.1.15, but it will not work and I get the following error on ...

81. What is the best way for (potentially) hundreds of mobile clients to access a MySQL database?

So, here is the deal. I'm developing an Android application (although it could just as easily be any other mobile platform) that will occasionally be sending queries to a server (which is ...

82. Writing a Java Method for Mysql use

These tables contain information about various machinery parts stored in dierent warehouse locations:

pid: integer,
description: varchar(128),
) Engine = InnoDB;

CREATE TABLE warehouse (
wid: integer,
address: varchar(128),
) Engine = ...

83. Java JDBC | Cannot run from console

I have developed a program where I do some database connections and send some queries with JDBC. I have used MySQL, NetBeans 6.9 under Ubuntu 11.04 as platform. When I run the ...

84. java code for migration of java db to mysql db

I have an application which is for doing db migration from java db to my sql.i want to know the code for using directly migrate java db to mysql? ...

85. Filling a combo box with mysql data

hi everyone i have this code but don't know why it doesn't work!

//in database class 

String query = "SELECT group_name FROM customer ORDER BY group_name"; 
java.sql.PreparedStatement stm = connection.prepareStatement(query); 

rs ...

86. Can't access a second MYSQL database wih Java

Is there something specific to be aware of when connecting to a second MYSQL database in java? I query one database db1 just fine, but when i switch to a duplicate databasedb2 ...

87. Java / MySQL on remote server

Ok, sorry if this question is stupid. I followed this tutorial: Now that I have it compiling in Eclipse, when I upload it to a remote server, how ...

88. How ReplicationDriver works

I am curious how com.mysql.jdbc.ReplicationDriver works. I have configuration with 1master & 1slave. I want to force some queries to JUST on slave. But it selects DB randomly and sometimes run it on master. Is ...

89. JDBC MYSQL SyntaxErrorException

I am executing the following queries with JDBC/SphinxQL (Sphinx version 2.01 Beta) with a WHERE clause:

ResultSet res = stmt.executeQuery("SELECT * FROM myindex WHERE MATCH('name')");
without a WHERE CLAUSE
ResultSet res = stmt.executeQuery("SELECT * FROM ...

90. Does MySQL included with MAMP not include a config file?

I can't seem to find the my.cnf or other config file for the MySQL that comes with MAMP. Does it not include one? I want to use NetBeans for Java/MySQL Development and ...

91. Jdbc and MySql not wanting to play nicely together

I have been working on a java application that has a connection to a mysql database. I can connect and run queries but when I try to take a string and ...

92. setting mysql session variables in jdbc

I want to run SET SESSION wait_timeout=172800 in java. I tried both executeQuery and executeUpdate, but the variable seems to be unchanged. How can i set the wait_timeout from my java ...

93. How to change a value in mysql database using conditions from java code?

I'm trying to change a value Dr_status that only contain one int even 0 or 1. So if Dr_status equal to 1 change it to 0 and vice versa. Here is the ...

94. how to solve this issue about InvalidClassException when deserializing objects from inputstream?

I am using james2.3.2 to be my mail server and the backend is mysql 5.5. I got a exception as the following: 23/06/11 16:39:49 DEBUG mailstore: Exception reading attributes in spool ...

95. database join questions

there are two tables in db

isbn integer, //primary key
title char(50),
publisher char(30),
year integer

isbn integer,  //foreign key 
name String,
rank integer,  // indicate whether it is author1, author2, author3,...,authorn
write a sql statement ...

96. Java - Store HashSet in mysql

How would I go about storing a HashSet with an unknown size in a mysql table. I know I can loop through it and store it into a longtext field. However when ...

97. How to import Tab delimited file in mysql database using java?

I want to import Tab delimited file in mysql database.How i can do using java. Thanks

98. Getting Month Start as First Day of week and add data week wise for next two month

I want to create a report ,which could give me the pending payment till now, and expected payment to come in next two month week wise. I mean if July is ...

99. DBCP: removeAbandoned VS eviction

I fail to figure out the difference between removeAbandoned and eviction. I read somewhere that removeAbandoned was deprecated, but it is not mentionned nowhere in the official doc ( So, if someone ...

100. How to use MySQL like operator in JDBC?

I have the following syntax in my code, but it is not working when I am trying to use the LIKE operator in JDBC. It works fine in this way, when ...  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.