Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC jdbc program

Have Programming Question? Ask it here!
 
 
 


akshara
jdbc program
2 Answer(s)      2 years and 4 months ago
Posted in : JDBC


  1. Write a program to update the salaryRs.6000/- for an employee name like ‚??P. Ramu‚?? using prepared statement.

Advertisement
View Answers

April 10, 2012 at 3:43 PM


import java.sql.*;

public class JdbcPreparedstatementUpdate {

  public static void main(String args[]) {

  Connection con = null;
  PreparedStatement pst = null;

  String url = "jdbc:mysql://localhost:3306/";
  String db = "test";
  String driver = "com.mysql.jdbc.Driver";
  String user = "root";
  String pass = "root";

  try {
  Class.forName(driver);
  con = DriverManager.getConnection(url + db, user, pass);

  pst = con.prepareStatement("update employee set salary=? where name=?");

  pst.setInt(1, 6000);
  pst.setString(2, "P.Ramu");

  pst.executeUpdate();


  pst.close();
  con.close();

  } catch (Exception e) {
  System.out.println(e);
  e.printStackTrace();
  }
  }
}


April 10, 2012 at 3:51 PM


import java.sql.*;

public class JdbcPreparedstatementUpdate {

  public static void main(String args[]) {

  Connection con = null;
  PreparedStatement pst = null;

  String url = "jdbc:mysql://localhost:3306/";
  String db = "test";
  String driver = "com.mysql.jdbc.Driver";
  String user = "root";
  String pass = "root";

  try {
  Class.forName(driver);
  con = DriverManager.getConnection(url + db, user, pass);

  pst = con.prepareStatement("update employee set salary=? where name like ?");

  pst.setInt(1, 6000);
  pst.setString(2, "P.Ramu%");

  pst.executeUpdate();


  pst.close();
  con.close();

  } catch (Exception e){
  System.out.println(e);
  e.printStackTrace();
  }
  }
}


Related Tutorials/Questions & Answers:
jdbc program
jdbc program   Write a program to update the salaryRs.6000/- for an employee name like ‚??P. Ramu‚?? using prepared statement
Jdbc and Socket Program - JDBC
Jdbc and Socket Program  Sir, I would like to get a program i... in a database.Now we create another program 4 client-server such that the sever's database is updated everytime we enter username and password in client program
Advertisements
execution of a jdbc program
execution of a jdbc program  how to execute a servlet program that..uses a jdbc driver (i.e. using mysql-connector -java )to connect to mysql in windows *PLS provid the execution steps in detail THANK YOU
java program - JDBC
of tables as fields, in this case i have three tables, i need a java program..., Please give details to solve the problem. For read JDBC connection to visit.... http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml
Java Program - JDBC
Java Program  A java Program that display data from a Table in MSAccess in JTable using JFrame  Hi Friend, Try the following code...("jdbc:odbc:access"); String sql = "Select * from data"; Statement stmt
JDBC Oracle program
JDBC Oracle program  Here is my code: import java.sql.*; public class Tyagi { public static void main (String args[])throws SQLException... = DriverManager.getConnection("jdbc:oracle:thin:@localhost:8080:oracle", "System", "System
Java Program - JDBC
Java Program  A java program that display in in a table in JTable
Java Program - JDBC
Java Program  A java program that display data in textfields and having buttons for move next, move previous,move last,move first using JFrame
Java Program - JDBC
("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:access... = DriverManager.getConnection("jdbc:odbc:access"); Statement st
jdbc connection to java program code - JDBC
jdbc connection to java program code  i want a simple java program that which communicates with oracle database like creating table,insert values and update records in database and show in program output? please take a simple
Jdbc Program for building Student Information Database - JDBC
Jdbc Program for building Student Information Database  import...;sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc...=DriverManager.getConnection("jdbc:odbc:Avishek"); s1=tf1.getText
How Jdbc program can be run??
How Jdbc program can be run??  import java.sql.*; import java.util.... { Connection conn=DriverManager.getConnection("jdbc:odbc:advdsn1","student","myself... created successfully and when i compiled this program then it compiled successfully
regarding connectivity program only - JDBC
regarding connectivity program only  can u give me code regarding... = "jdbc:mysql://192.168.10.211:3306/"; String db = "amar"; String driver... for more information. http://www.roseindia.net/jdbc
how to run jdbc program in linux-ubuntu?
how to run jdbc program in linux-ubuntu?   how to run jdbc program in linux-ubuntu
regarding connectivity program only - JDBC
regarding connectivity program only  can u give me code regarding .. that i had created student data base with his name and subject marks resp ... i use html in front end ...that there r options like 1.name---------- 2.sub1
how to run jdbc program in linux-ubuntu?
how to run jdbc program in linux-ubuntu?  how to run jdbc program in linux-ubuntu?   hi firstly download the jdk on your system using... to compile java program javac prog.java java prog
write a program for complete JDBC based application
write a program for complete JDBC based application   thank you sir giving answer for my question. my another question is: Write a complete JDBC... and the program should have the facilities of Adding, Modifying, Viewing and Deleting
how to run jdbc in jsp program - JSP-Servlet
how to run jdbc in jsp program  i want to use sql server 2005 in jsp program to store data.i know how to run simple program but this program i tried my best i am not able to do so.please give me the answer of this as soon
Jdbc
Jdbc  A java program with jdbc connectivity with insert,delete,update options for name,regno,mark1,mark2,total
jdbc
jdbc   how to write program to save data and retrieve data from the form in Java
program
program  program of jdbc using ms access for creating table
jdbc
jdbc  I can't run my jdbc program because it has error in this line: public static void main(String[] args) the error is:illegal static declaration in inner class would you please let me whats the problem? regards
jdbc
jdbc  how to update int values of ms-access in jdbc program?   In MS Access database, use Number data type for int values. import... =DriverManager.getConnection("jdbc:odbc:access","",""); Statement st=null; st
jdbc
jdbc  Hai , Give a steps for jdbc connectivity
jdbc
jdbc  display the records using index in jdbc
JDBC
JDBC  why we use batch in jdbc
JDBC
JDBC  How to add set of queries in a single query in JDBC
JDBC
JDBC  write a JDBC program to display the result of any query on a student table in a JTable component.   import java.awt....").newInstance(); Connection con = DriverManager.getConnection("jdbc:mysql://localhost
JDBC
JDBC  can u send me the code of jdbc how to join two tables that are in relation
jdbc
jdbc  is it possible to use doget & dopost method with jdbc to call in a servlet programe
JDBC
JDBC  in class.forname which driver name we are writing for the connection from jdbc to sqlserver 2008
JDBC
JDBC  how to set classpath for eclipse, java, where to copy jdbc connector
jdbc
jdbc  why do we need to load jdbc drivers before connecting to database
jdbc
jdbc  please tell me sir.i dont know JDBC connection and how to create table in database
jdbc
jdbc define batch updates  define batch updates?exp   JDBC... links: http://www.roseindia.net/jdbc/Jdbc-batch-update.shtml http://www.roseindia.net/tutorial/java/jdbc/batchupdateresultsetexample.html
jdbc
how i can access Microsoft Access database by java program  how i can access Microsoft Access database by java program ? if any package or jar file...("jdbc:odbc:student"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver
JDBC
JDBC save a data in the database  I need a code to save a data... between java and mysql using JDBC and saves the data into the database. import... con = null; String url = "jdbc:mysql://localhost:3306/"; String db
JDBC
JDBC code to save a data in the database  I need a code to save... the connection between java and mysql using JDBC and saves the data into the database...!"); Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db
jdbc
how can we call stored procedure using jdbc  how can we call stored procedure using jdbc   Call a Stored Procedure using...(); For more information, visit the following link: JDBC call Stored Procedure
jdbc
how can we set transaction level through jdbc api  how can we set transaction level through jdbc api   Use Connection.setTransactionIsolation(int) to set the desired tansaction level, which takes one of the 5 arguments
jdbc
jdbc  hey sir i just wanna have some ppt on jdbc coz have my exams next week and i have not attended any classes coz of job... I m studyng frm niit
jdbc
how can we set transaction level through jdbc api  how can we set transaction level through jdbc api   Use Connection.setTransactionIsolation(int) to set the desired tansaction level, which takes one of the 5 arguments
jdbc
(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost... information, visit the following link: JDBC Tutorials
jdbc
jdbc  i had written jdbc connection in method and i need to get connection in another class?   import java.sql.*; class... driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/test
jdbc
using jdbc connection   import java.sql.*; public class CreateTable... = DriverManager.getConnection("jdbc:odbc:student"); Class.forName
JDBC - JDBC
JDBC - limitations of jdbc  What are the limitations of JDBC
jdbc - JDBC
Why JDBC   JDBC used for what
jdbc
jdbc   Write a program to update the salaryRs.6000/- for an employee name like ‚??P. Ramu‚?? using prepared statement
jdbc
how to connect JSP page to database - JDBC  how to connect JSP page to database ?give program
JDBC
retrieve the value from database into dropdown list using JDBC SQL 2005  How to retrieve the value from database into dropdown list using JDBC &...").newInstance(); String connectionURL = "jdbc:mysql://localhost:3306/test";; Connection
 

 

 

DMCA.com