db error 2 Answer(s) 4 years and 2 months ago
Posted in : Java Beginners
View Answers
May 5, 2009 at 10:28 AM
hello, you have to change the datatype of the field in which you are inserting your text area content. if you are using mysql then put the datatype as "longtext".
class Form extends JFrame { Form() { JLabel label = new JLabel(); label.setText("Enter Description:"); JButton ADD=new JButton("Insert"); final JTextArea area =new JTextArea(10,25);
final JPanel panel=new JPanel(new GridLayout(2,2)); panel.add(label); panel.add(area); panel.add(ADD);
add(panel,BorderLayout.CENTER); ADD.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ String value=area.getText(); Connection con = null; String url = "jdbc:mysql://192.168.10.126/"; String db = "roseindia"; String driver = "com.mysql.jdbc.Driver"; String user = "root"; String pass = "root"; try{ Class.forName(driver); con = DriverManager.getConnection(url+db, user, pass); Statement st = con.createStatement(); int i= st.executeUpdate("Insert into Description(description) values('"+value+"')"); JOptionPane.showMessageDialog(null,"Data is successfully inserted into the database." ); st.close(); con.close(); } catch(Exception e){ System.out.println(e); } } }); } } class InsertTextArea{ public static void main(String arg[]) { try { Form frame=new Form(); frame.setSize(300,100); frame.setVisible(true); } catch(Exception e) {} } } You have to put the 'text' or 'longtext' datatype for the textarea field in the database table.
Thanks
Related Pages:
ERRor in executing DB program ERRor in executing DB program While executing following code an Error was generated.can any one help me for this.
LiveDB liveDBObj...=pstmt.executeUpdate(qry);
----------
**ERROR:java.sql.SQLException: You have
Zend Db error - WebSevices
Zend Db error Hello friends,
How i get the values from the database using zend framework
Any one know the code. Help me
db error - Java Beginners db error Hi,
how to insert text area content into database...://192.168.10.126/";
String db = "roseindia";
String driver = "com.mysql.jdbc.Driver...(driver);
con = DriverManager.getConnection(url+db, user, pass
no data in db
no data in db Using the example in "Networking/web-services-database.shtml" managed to do everything as shown above but there is no data in the database. the result is "record inserted". where can the error
getting db in action class
getting db in action class hi,
Am usin struts in ma application...
n i need to interact with the db ..
so i used.. getDataSource(request)
but it gives me an error..
java.lang.NoSuchMethodError: LoginAction.getDataSource(Ljavax
Aggregrate function Max() in db
and stuck with this problem.
i have a table like Brand in mySql db where brandid(varchar) is generating automatically..
im having a Db connection class and a method... (SQLException sq) {
System.out.println("error" + sq);
return "error
JSP,DB,SERVLET
JSP,DB,SERVLET I have a jsp page called page1.jsp with 3 text fields name,phone ,city.i populated these datas into a database table through servlet...)
{
request.setAttribute("Error", e.getMessage());
rd
java connecting to oracle db
(WindowEvent we)
{
System.exit(0);
}
});
}
}
I GOT ERROR FOR THIS PROGRAM
ERROR:java.lang.ClassNotFoundException
View Photo From Db MySql
View Photo From Db MySql Good Morning Sir,
Please help me, I make a small code but i have a error. I want to make viewer photo from database...);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null,"error "+e
JAVA DB connenting Office access..
JAVA DB connenting Office access.. hai friends....iam shackir..
i... HELP ME"
ERROR IS :
3
SQl error in insertValues methord
java.sql.SQLException...(SQLException sqe){
System.out.println("SQl error from retrieve data
how to featch data form db?
how to featch data form db? how to featch data form db?
 ... response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest
retrieving from db - JSP-Servlet
the following errors wen i am running the prg. the error is as follows. I can't figure out why i am getting the error. anyone help!
org.apache.jasper.JasperException
Insert Image in DB through Servlet - JSP-Servlet
Insert Image in DB through Servlet Dear Sir,
You write me:
copy...
Ohterwise send ur mailid
Thanks'
Rajanikant
But Sir, Its show a error.
Error
You want to download the following file:
http://rapidshare.com
Insert Image In DB through Servlet - JSP-Servlet
Insert Image In DB through Servlet Dear Sir,
My previous Query... a deploy time error in RED Color.
Please review...
Hi friend... insert this tag, You not getting any red color error
YourServletname
Insert Image in DB through Servlet - JSP-Servlet
Insert Image in DB through Servlet Dear Sir,
My previous Query... a deploy time error in RED Color.
Please review...
Answers Hi friend,
To insert...
________________________________________
inside Your web-app tag insert this tag, You not getting any red color error
Insert Image In DB through Servlet - JSP-Servlet
Insert Image In DB through Servlet Dear Sir,
My previous Query... a deploy time error in RED Color.
Please review...
Answers Hi friend,
To insert...
________________________________________
inside Your web-app tag insert this tag, You not getting any red color error
JSF error
JSF error some of the users are not able to update the db.
getting the error
"An Error Occurred:
Error calling action method of component with id CreateorManageOffer:jidjsp134312524923
Caused by:
java.lang.NullPointerException
error - JDBC
error i wrote the program using dbms type 4 driver.it is comipled,i got a errors
d:temp> java DBConnect
db Connect Example...(String[] args) {
System.out.println("db Connect Example.");
Connection
db connectivity db connectivity hi
i am beginner in objective c lang and having knowlwgde of basic syntax of this lang and need statements that can be used to connect to sqlite.
please do send me the simple example code. i am using GNUstep
SQL Error - SQL
SQL Error Invalid character value for cast specification on column number 5 (Designation)
Whats this error about this if the field i specified in programming error.
ie DB fields in above question
Java Compilation error - Development process
. Create db connection to xls file using code you posted.
2. Create db connection to remote db where you want to upload the data.
3. Read the data from xls using first db connection.
4. Insert the data to remote db using second db
Program Error - WebSevices
_on' => new Zend_Db_Expr('CURDATE()'),
'bug_description' => 'Something wrong',
'bug_status' => 'NEW'
);
$db->insert('bugs', $data
j2me with derby db - MobileApplications
j2me with derby db Hello, Presently Iam working on the j2me(wireless toolkit2.0).I have done so many applns in j2me,but I want to install derby db in j2me.I am new to derbydb. Can u tell me briefly abt derby db,which version
error oracle database connection? error oracle database connection? hi now i am trying to connect... javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class newuser_db
*/
public class newuser_db extends HttpServlet {
private static final long serialVersionUID = 1L
about db - Struts
About DB in Struts I have one problem about database. i am using netbeans serveri glassfish. so which is the data source struts config file should be? Please help me
trap error - Java Beginners
trap error Hello. Am trying to trap this error that appears when i post blank fields to database. "[Microsoft][ODBC Microsoft Access Driver] Data...){
out.println(e.getMessage());
}
}
}
i can insert to db
error
error while iam compiling iam getting expected error
Server DB connection - JDBC
Server DB connection Hello Guys I want to connect two databases at the same time but it looks like the java is only picking up the second database.
One database is on my localhost and the other one is on server, I want
JSP,DB,SERVLET
JSP,DB,SERVLET I have a jsp page with 3 text fields name,age ,city.i populated these datas into a database table.I have another jsp page with 4 fields name, city , age and phone.Once the user enter the name, city and age should
Error- Error- Hello, I would like to know about XSD file.
I try to print XML file but I am getting error SAXException-- says
Content is not allowed in prolog.
Please help me
error
error i have 404 error in my program plz tell me yhe solution about
error
error i have 404 error in my program plz tell me yhe solution about
how to migrate java db to mysql
how to migrate java db to mysql I have an aplication,for migrating java db to mysql db.how it will done
Error
Error I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'.
This error come only in IE browser, but in other brower
DB Schema Viewer DB Schema Viewer
DB Schema Viewer is an Eclipse plugin that builds a graphical view of an existing database. Reverse Engineering is performed through JDBC
error in web application error in web application In your application when i am trying...;
String url = "jdbc:mysql://localhost:3306/";
String db = "test";
String driver... = DriverManager.getConnection(url+db,userName,password);
String query = "select * from
error
error java.lang.unsupportedclassversionerror:bad major version at offset 6
how to solve this????
Hi,
Please check the version of framework used and also the JDK version.
This type error also comes when java file
error
error When I deploye the example I have this message
cannot Deploy HelloWorld
Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
JSP,DB,SERVLET
JSP,DB,SERVLET hi thank you for your reply.With this code i can insert the data successfully into database but In ajax.jsp once i give the name;;;age and city are not automatically fetched......instead sumthing get filled
JSP,DB,SERVLET
JSP,DB,SERVLET hi thank you for your reply.With this code i can insert the data successfully into database but once i give submit button in insert.jsp it should be forwarded to ajax.jsp.In ajax.jsp once i give the name;;;age
Error
Error Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance.
package...;");
// ERROR
out.println(" var pattern