473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how can I display data into my Jtextarea from my data base Mysql

hi,
I have problem when I try to displa data from my database mysql to my jTextarea,when I compile I have an error exception like :

Expand|Select|Wrap|Line Numbers
  1. SQL Exception: java.sql.SQLException: Can not issue SELECT via executeUpdate()
I have used a select query from my table where the name is the name writed in my jTextfield,this is my code,I hope that some one help me because I don't know how to reesolve the problem and thanks:

Expand|Select|Wrap|Line Numbers
  1. String pilote = "com.mysql.jdbc.Driver";
  2.                 jComboBoxType.addItemListener(new ItemState());
  3.         jComboBoxMenaces.addItemListener(new ItemState());
  4.  
  5.               try {
  6.  
  7.  
  8.                  Class.forName(pilote); 
  9.  
  10. Connection connexion = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root"," "); 
  11.  
  12. Statement instruction = connexion.createStatement(); 
  13.  
  14.             String a=jTextFieldNom.getText();
  15.  
  16.  
  17.             String SQL = "select description from table where nomcol="+a+";"; 
  18.             ResultSet rs = instruction.executeQuery(SQL);
  19.             instruction = connexion.createStatement();
  20.  
  21.  
  22.             int rowsEffected = instruction.executeUpdate(SQL);
  23.             jTextArea1.append(rs.getString("description"));                                    
  24.  
  25. }
  26. ...... //bloc catch 
Apr 9 '12 #1
0 1820

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dave | last post by:
Hi I m facing strange problem... I have one field char type data length 1.. It has data either 1 or 2 in all the field tht I have checked through enterprise manager. I'm running query "select...
5
by: yma | last post by:
Hello, I tried to display a column in MS Access 2000 nwind.mdb using 3 data controls. But I got "It is already opened exclusively by another user, or you need permission to view its data." I...
9
by: dennist685 | last post by:
Walkthrough: Creating a Web Page to Display Access Database Data I've started the above walkthrough. However, near the beginning it gives the following instructions To set permissions in the...
3
by: asadikhan | last post by:
Hi, I am trying to use a datalist to edit data in a MySql database as follows. For now I just want to be able to get the changes to be made on the dataset. Here is my code: using System;...
0
by: ramyanet | last post by:
Dear all, Is there any way to directly transfer the data from excel to mysql database without using any tools,but thro coding. pls help me .hope i'll get a soln soon. Thanks Regds,
0
by: nanaalwi | last post by:
hi there, im doing a project right now to download a data from EEPROM of a camcorder. i used a 'data grid view' to display all the data downloaded from the camcorder. however, i have to save the...
1
by: chirag thakor | last post by:
how i can import data from Excel to MySql using php.
1
by: Bob Johnson | last post by:
..NET 3.5, Windows Forms app: My objective is to display parent/child data in two ComboBox controls, such that when a parent item is selected in one combo box, associated child items appear in the...
13
by: chromis | last post by:
Hi, I have a query which updates the projects table of my database, however when I try to run my query with blank values i get the following error: Data truncation: Data truncated for column...
1
by: npm | last post by:
I'm trying to find out why the android browser won't load and/or display my XML data. This javascript works fine on computer browsers (FF, IE, Safari, Chrome, Opera) and even in iPhone's Safari, but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.