Home Answers Viewqa JDBC mysql tables

 
 


uma
mysql tables
2 Answer(s)      4 years and 9 months ago
Posted in : JDBC

View Answers

October 1, 2008 at 11:20 AM


Hi,

You not mention ur requirement properly mean insert or update or select or what?

I gave a sample program you have to modify as per ur field.

package rajanikant.code.oct_2008;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class MySqlTest {

private Connection con = null;
private Statement stmt;
private PreparedStatement pst;

private ResultSet rs ;

public void getConnection(){
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/databasename";, "root", "");
} catch (ClassNotFoundException e) {
System.out.println("Driver Class Not Found");
} catch (SQLException e) {
System.out.println("Connection Error");
}
}

public void myStuff(){
getConnection();

try {
stmt = con.createStatement();
rs = stmt.executeQuery(" Your Query");

pst = con.prepareStatement("Insert Into your-tablename values(?,?,?,?)" );
//depend upon "?" we have to write the following line
pst.setString(1, "value1");
pst.setString(2, "value2");
pst.setString(3, "value3");
pst.setInt(4, 6);
rs = pst.executeQuery();
} catch (SQLException e) {

}
}

public static void main(String s[]){
new MySqlTest().myStuff();
}
}


Rajanikant

October 1, 2008 at 11:27 AM


Hi,


I am sending a link. This link will help you.

Please visit for more information.

http://www.roseindia.net/jdbc/


Thanks.

Amardeep









Related Pages:
Different tables present in MySQL
Different tables present in MySQL  What are the different tables present in MySQL? Which type of table is generated when we are creating a table...; Hi friends, Total 5 types of tables we can create 1. MyISAM 2. Heap 3
Mysql List Tables
Mysql List Tables       The Tutorial illustrate an example from 'Mysql  List Tables'. To understand this example we use show tables query that return the list of tables
mysql tables - JDBC
mysql tables  hi, I have a table in MySql, having fields, emp... mangager for MySQL, statements, preparedstatements,resultset. Please can you..."); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/databasename
mysql select from multiple tables
mysql select from multiple tables   how can i select the date field from multiple tables in mysql?   "UNION" can be used to select data from multiple tables in my sql... for example (SELECT * from name where `name
Comparing tables
Comparing tables  How to compare two or more tables in the Mysql database using jdbc
Mysql List Tables
Mysql List Tables       The Tutorial illustrate an example from 'Mysql  List Tables'. To understand this example we use show tables query that return the list of tables
Purge Data from Mysql tables
Purge Data from Mysql tables  Hi, i have to write a mysql procedure to purge data from tables. but written procedure clear entire tables data. Please give me the solution for purging data. CREATE DEFINER=`root`@`localhost
Mysql Join 3 Tables
Mysql Join 3 Tables       Mysql Join 3 Tables is used to join 3 Tables using left join... an example from 'Mysql Join 3 Tables' using Left Join. To grasp this example
Fixed size tables
Fixed size tables  Can anyone help me in creating a fixed size table in mysql database
Creating Database Tables and Indexes
Creating Database Tables and Indexes   ... the allowable syntax for identifiers in MySQL. The identifiers are Database, table, index... in identifiers. But avoidance of doing so if possible then it is best. The MySQL
Setting up MySQL Database and Tables
Setting up MySQL Database and Tables       I am assuming that you have running instance of MySQL Database and you know how to work with the MySQL database. To access the database
Natural Join of tables using DBCP
;com.mysql.jdbc.Driver");     bds.setUrl("jdbc:mysql... tables. Below shown two tables and record stored in it. Salary Employee... and mysql-connector-java-5.1.7-bin.jar In the pathset.bat write following
Mysql Alter Tables
Mysql Alter Tables This example illustrates how to alert the table and how it is used in query. In this example you will see all tables in test database....   Query show tables
Joins tables in jsp
Joins tables in jsp       When we want to select data from two or more tables to make our result complete. We have to perform a join between tables
Join tables in the specific database
Join tables in the specific database   ... and tables in a database. Now to retrieve a particular row from a table... two or more tables in a specific database. For this you need to have two
join tables mysql
.style1 { font-weight: bold; } join tables mysql... and the result will be displayed in the browser. To join the tables firstly it is important... are using the MySql database. To join the table it is important to have those
JSP hide and show tables
JSP hide and show tables In this tutorial, you will learn how to hide and show html tables using javascript in jsp. Here is an example of simple jsp code... conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test"
Nest tables within tables
Nest tables within tables  Can I nest tables within tables
how to do two database tables in one page?
how to do two database tables in one page?  dear all: i want to show these two database tables in one page. one table on the left (dbtable.jsp... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root"); Statement st
Cross Join Tables in a Specific Database
Cross Join Tables in a Specific Database   ... join between two tables. The cross join operation retrieves data between two tables as a Cartesian product of set theory in mathematics. Each row will get
Retrieving Tables from a Database
Retrieving Tables from a Database   ... the tables. To work with this, it is very important to know how to retrieve... for retrieving tables from a specific database through an example. In relational
search in Two Tables to Find data and view by jsp
search in Two Tables to Find data and view by jsp  hi i want search in Two Tables to Find data and view by jsp <%@page import...(); %> <% conn = DriverManager.getConnection("jdbc:mysql://localhost
MySQL Create Database
and modification of tables. The MySQL Table Editor can be accessed from the MySQL Query... & 5 library to allow easy and user-friendly editing of MySQL tables. Note... MySQL Create Database       MySQL
Mysql List
Mysql List       Mysql List elaborate you an Query for listing databases, tables, Procedure... illustrate an example from 'Mysql List'. To grasp this example, We show you
Mysql List
Mysql List       Mysql List elaborate you an Query for listing databases,tables... illustrate an example from 'Mysql List'. To grasp this example, We show you
how can i hide and show tables
the code is included below i want to hide the tables initially and after i click go i want to display the tables with result.so any help is appreciated much <...").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql
what is the jsp coding to insert a data in database tables
that insert the form values to MySQL database. 1)register.jsp: <html> <form..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost... the "Connection con = DriverManager.getConnection("jdbc:mysql://localhost
Natural Left Join of tables using DBCP
;);     bds.setUrl("jdbc:mysql://localhost:3306/mydb"...;} } Before running this program you need to make two tables. Below shown two tables and record stored in it. Salary Employee Directory
tables for layout
tables for layout  Are there any problems with using tables for layout
tables for layout
tables for layout  Are there any problems with using tables for layout
Natural Join / joining two tables
two tables according to common field and Create a new virtual field. We... tables before join -- "employee" table "emp_sal" table... = DriverManager.getConnection("jdbc:mysql://192.168.10.13:3306/ankdb","root","root
CSV tables
CSV tables  hello, What are CSV tables?   hii, CSV Tables cannot be indexed.CSV Tables are the special tables, data for which is saved into comma-separated values files
mysql query
mysql query  I have two tables namely sms and bdpaidbribe. I want to insert a column "Message" of sms table into "caddiinfo" column of bdpaidbribe table. and whenever the Message is inserted into sms table it should automatically
MySql,java
MySql,java  In MySQL table i am adding the fields of name,photo,video,age,category.in the category i have some subjects.if one person login into my... procedure is it necessary to create different tables for each category.and also
PHP MySQL query
PHP MySQL query  I have 11 tables and have to do the CRUD operations keeping userid as a reference key
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... for retrieving data fromm two tables : first table having fields: bookid,name...("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... for retrieving data fromm two tables : first table having fields: bookid,name...("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... for retrieving data fromm two tables : first table having fields: bookid,name...("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql
How to Generate XML files from the data in DB tables?
How to Generate XML files from the data in DB tables?  HI Experts, I have a doubt. I have a table say Pest. My task is to generate XML file...").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql
mysql andservlets - JDBC
mysql andservlets  I have two tables with primarykey fields.I need to retrive records from two tables using their primary key.What is the query in mysql?and what is the code in servlets?  Hi friend, For solving
MySQL Configuration
MySQL Configuration       In this lesson you will read how to configured of mysql.  This lesson you will also read how to easily configuring your server under window . The mysql
Establish a Connection with MySQL Database
coding methods of establishing the connection between MySQL database and quartz application for updating and manipulating the data of MySQL database tables. Here... Establish a Connection with MySQL Database   
Mysql Natural Join
Mysql Natural Join       Mysql Natural Join is a specialization of equi-joins. The join compares all columns in both tables that have the same column-name in both tables that have
MySQL Commands
MySQL Commands       In this section, we are going to read about the mysql commands. Each statement is sent to the server for the execution by MySQL. MySQL provides lots
Mysql-Php code
Mysql-Php code  I want to mysql script for query data from two tables in the mysql database trough php code. Can you help me   Hi Friend, Please visit the following link: Php Mysql Thanks   Hi Friend
Learn how to take MySQL Backups and restore the same.
Learn how to take and then restore the MySQL database backup. You can use mysqldump utility to take the backup of MySQL database and tables with or without.... Following example shows how to take MySQL backup
MySQL Access Control
control system and throws some light on the MySQL grant tables. These tables... MySQL Access Control       MySQL Security Access Control Most users concentrate on MySQL's databases
Foreign key in mysql
it to a database using php and mysql. I need to create the databases in phpmyadmin and have decided on the structure of the tables in the database. However, as expected, there are foreign keys in some of the tables - does anyone know how to link
MySQL Front
, flush Host/Logs/Privileges/Tables and much more. You can also use mySQL-Front... MySQL Front       In this page you will find many tools that you can use as MySQL Front to work with the MySQL