Home Discussion Discuss: Inserting values in MySQL database table

  • insert statement with where statementsuraj kumar April 14, 2011 at 3:15 PM

    hi.. I m stopped here i cant find the write coding for the next step of my work. I will be thankful to if u send me the answer coding. i want to fill data into a predefined datatable by knowing the primary key of the particular column.

  • mysql programkarthikeyan May 31, 2011 at 10:57 PM

    wow! what a simple and understandable coding

  • JDBC INSERTashish August 20, 2011 at 12:33 PM

    import java.sql.*; public class dj { public static void main(String args[]) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con= DriverManager.getConnection("jdbc:odbc:ashish1","",""); Statement st=con.createStatement(); st.executeQuery("Select * from ashish1"); st.executeUpdate("INSERT ashish1 VALUES('nit',85)"); System.out.print("test"); ResultSet rs=st.getResultSet(); while(rs.next()) { System.out.print(rs.getString(1)); System.out.println(rs.getString(2)); //rs.executeUpdate(); } //con.close(); } catch(ClassNotFoundException e) { System.err.println(e); } catch(SQLException e) { System.err.println(e); } } } \\ Is this above code corretc how to insert the new data.

  • i am getting an errorVenkat Santosh November 23, 2011 at 9:38 AM

    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

  • javasuresh December 30, 2011 at 6:18 PM

    good

  • issue with this codeAnkit January 14, 2012 at 8:40 PM

    This code does not close statement and connection . thats a serious resource leak.

  • no commentsallan April 30, 2012 at 4:22 PM

    your code got no comments... It's hard to understand. Anyway, it's usable anyway.

  • errorblessy September 17, 2012 at 1:32 PM

    when i execute it gives this error while executing java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at insert.main(insert.java:12)

  • i have a problemanon October 9, 2012 at 8:33 AM

    sir, can you help me? when i execute insert commands my values in the textfield are not stored into the table. instead, it saves BLANK data. my program says it recorded the data but when i look at the table there is no data, only blank field.

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
JDBC

Inserting values in MySQL database table
Inserting values in MySQL database table   ... the facility for inserting the values in MySQL database table. Description... insert values in the MySQL database table. We know that tables store data in rows 

JDBC Questions

Query to insert values in the empty fields in the last row of a table in Mysql database?
Query to insert values in the empty fields in the last row of a table in Mysql database?  I have some fields filled and some fields empty in the last row of my MYSQL database. Now I want to fill up those empty fields in the last 

PHP Questions

WANNA IMPORT RAINBOW TABLE IN MYSQL DATABASE
table in one and then i want to import the values of rainbow table in mysql... to import rainbow table in mysql database thanks...WANNA IMPORT RAINBOW TABLE IN MYSQL DATABASE  hello, i have 

JSP Servlet Questions

inserting dropdown values into database table
inserting dropdown values into database table   hi i want to insert dropdown values into a database table by using jsp 

Java Beginners

How to Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database(MySql)?
) and save the new position (values) also in database(MySql)?  Hi members, I have one Html table in jsp page and i am iterating values (in columns of html table)from Database, Now i am Dragging and dropping one HTML table row to another 

JavaScript Questions

How to display all the Select values from the MySQL database table in where condition= In JSP?
How to display all the Select values from the MySQL database table in where... to display all the select values from MySQL DB** only first value is displayed in the jsp file. @select * from table dept where dept_no=10;" jsp code i have used 

JDBC

Inserting Image in Database Table
Inserting Image in Database Table   ... to the MySQL database table.  Flow of the process : This program helps the user to insert an image in the MySQL database table. To insert 

JSP Servlet Questions

Inserting values into a database table of selected DropDown in jsp.
Inserting values into a database table of selected DropDown in jsp.  ... to insert all selected values in data base correspondent to each like if user selected india and then goa. I want to insert it to a table which has two fields 

Servlet Interview Questions

How to Display values from databse into table
How to Display values from databse into table  I want to display values from database into table based on condition in query, how to display that? For example i have some number of books in database but i want to display books 

MySQL

Mysql Create Table
Mysql Create Table       Mysql Create Table is used to create a table in database. Understand with Example The section of Tutorial will help you to create a table in database 

JDBC

Copy Table in a MySQL Database
Copy Table in a MySQL Database     ... in a same MySQL database. Description of Code: This program helps you in copying one table to another in a same MySQL database. To copy any table,  firstly 

JSP Tutorials

Create a Table in Mysql database through SQL Query in JSP
Create a Table in Mysql database through SQL Query in JSP...; This is detailed java code to connect a jsp page to mysql database and create a table of given...;head> <title>Create table in mysql database using jsp< 

Java Server Faces Questions

Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database
table in jsp page and i am iterating values (in columns of html table)from Database, Now i am Dragging and dropping one HTML table row to another position.I want to save the position ( new position) in database(MySql).How to do this?Please 

Java Beginners

Getting mysql table in textbox
Getting mysql table in textbox  how to get mysql table values into textbox in java using ajax and servlets 

Management

MYSQL Database
MYSQL Database  Can any one brief me about how to use MYSQL Database..., the MySQL database server is most popular database server and if you want to know about creating table and using MYSQL, just follow the below link 

JSP Servlet Questions

fetch record from MYsql table query
fetch record from MYsql table query  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table 

JSP Servlet Questions

HTML & MYSQL - retrieve record from table
HTML & MYSQL - retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai... table. Actually they are separated by comma. I want to take the values as single 

JSP Servlet Questions

MYSQL retrieve record from Data table
MYSQL retrieve record from Data table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy... table. Actually they are separated by comma. I want to take the values as single 

Struts Questions

how to display the database values in pdf format
how to display the database values in pdf format   in struts how to display the values in pdf format when clicking a button in jsp page   ...")); document.open(); PdfPTable table=new PdfPTable(2); table.addCell("Name 

JDBC Questions

how to count unique and duplicate values from one table in mysql?
how to count unique and duplicate values from one table in mysql?  I have use EMP table.I want to count unique and duplicate records from emp table and how to use in java program 

JDBC Questions

database
database  How can i get combo box values from database?? or how can i get values in the drop down menu of the html which is similar to dat... from where can i download mysql?  my table name is office_name column 

JSP Servlet Questions

how to import excel sheet into mysql database and save it as a table in database
how to import excel sheet into mysql database and save it as a table in database  sir, i want to import an excel sheet into a MySQL database and after importing it i want to store the excel sheet as a table in database 

MySQL

Mysql As
from 'Mysql As'. To understand this example we create a table 'stu'. The create...(Id int,Name Varchar(15)); Insert values into Stu Once your table... Mysql As       Mysql 

PHP Questions

php csv file uploding into mysql database table.
php csv file uploding into mysql database table.  hai friends, i... fields. i have one mysql database table with two files fields, when ever i am uploding csv file, i want to fetch the datas in corresponding fields in table. can 

JSP Servlet Questions

Printing Values of Resultset to Html Table
Printing Values of Resultset to Html Table  I have a resultset and I need to collect the resultset values into the arraylist into a table... in advance   JSP Display values of ResultSet to HTML table: <%@page 

MySQL

Setup MySQL Database
Setup MySQL Database          In this section we will create database and table into MySQL database. Table created here will be used in sample application 

JSP Servlet Questions

fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table as if i am...(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test 

JSP Servlet Questions

fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table wth edit... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root", "root"); Statement st 

MySQL

PHP Mysql Database Connection
PHP Mysql Database Connection       PHP Mysql Database Connection is used to build a connection... The Tutorial illustrate an example from PHP Mysql Database Connection 

JSP Interview Questions

How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.   I have the same problem.plz help me. I have MySQL DataBase/DB Name:lokesh; Table Name:TR_list; columns:nodename,packageno,TR 

DMCA.com