Question: sql



Share on Google+Share on Google+

Ragini Shukla
1 Answer(s)      8 years ago
Posted in : Java Beginners
View Answers

October 11, 2008 at 1:20 PM

Hi friend,

<%@ page language="java" import="java.sql.*;"%>

System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;;
String dbName = "databasename";
String driver = "com.mysql.jdbc.Driver";
String username = "root";
String userPassword = "root";
try {
conn = DriverManager.getConnection(url+dbName,username,userPassword);

Statement stcount1 = conn.createStatement();
String strQuery1 = "insert into sales_transaction set __LongTerm__

int i1 = stcount1.executeUpdate(strQuery1);
Statement stcount2 = conn.createStatement();
String strQuery2 = "insert into sales_line set prod_id="+prod_id+",packing='"+packing+"',rate="+rate+",qty="+qty+",amount="+amount;
int i2 = stcount2.executeUpdate(strQuery2);

catch(Exception e)

For more information on JDBC-Mysql visit to :



Related Tutorials/Questions & Answers:
difference between sql and oracle  what is the difference between sql and oracle
sql  how to get first row in sql with using where condition in sql? how to get last row in sql with using where condition in sql
sql  I want interview sql questions   Please visit the following link: SQL Tutorials
Sql  how to find maximum of a101,a102,a103 from a table in sql
SQL  hii What is sql?   hello, SQL, which stands for Structured Query Language, is a special-purpose language used to define, access, and manipulate data. SQL is non procedural, meaning that it describes
sql  returning value from a store procedure in sql with example   Please visit the following links:
SQL  In my computer i have microsoft sql can i set that in the cmd.i want to use that in cmd.what is the default username and password
SQl  . Given two tables: table1(player, groundname, numcenturies); table2(ground_name, country); Write and SQL query for the following: " Select all the players from table1 who has
SQL   1)How to Store 1000 records in Oracle object. 2)Write a query for calculate highest, 3rd Highest & 10th highest salary from emp teble. 3)What is Sequence. 4)How to use rowid in Sql. 5)What is Views. 6)How
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM
SQL Trigger query  Why we use the Trigger and what it's uses?   A database trigger is procedural code that is automatically executed..., user events, and SQL statements to subscribing applications 10)Restrict DML
events, user events, and SQL statements to subscribing applications 10)Restrict DML
, user events, and SQL statements to subscribing applications 10)Restrict DML
events, and SQL statements to subscribing applications 10)Restrict DML
tables EMP, and DEPT, the structure for which are given above. Write SQL queries
sql - SQL
order by SQL Query  What is order by in SQL and when this query is used in SQL?Thanks!  Hi,In case of mysql you can user following query.Select salary from salary_table order by salary desc limit 3,1Thanks
sql - SQL
want query? 4.what is the diffrence between sql and plsql?  Hi Friend... HAVING n>1; Difference between SQL and PL/SQL: SQL is a structured query...(select,insert,update etc.), manipulate objects(DDL) and data(DML). PL/SQL
sql - SQL
sql  write a dyamic sql program to display the name of a employee whose salary is <5000  Hi Friend, Use the following query... the following link: Thanks
SQL  How to combine 'LIKE' and 'IN' operators in sql query?   select name from tab1 where name like 'R%' AND city in('bangalore','mumbai'); Table Name: tab1 FieldName ===================== | name | city
SQL  Jus c da case we hve certain images in some folder or some area in sql can we create trigger or procedure so dat in front like in asp page while clicking image it will be showed in page ...... ...I mean writing code for each
sql - SQL
sql functions with examples  I need sql functions with examples to learn fast.  Hi friend,<%@ page language="java" import...("SQL statement is not executed!"); } } catch (Exception e
sql server - SQL
sql server  what is SQL server? & what is oracle? are they same
sql server - SQL
sql server  How many no of tables can be joined in same sql server
SQL help - SQL
SQL help  Hi Deepak, Can u pls tell me what is the difference between PL/SQL and MYSQL? Is there any difference in generating the code
SQL JOINS  Hom many Joins In Sql?plz explian all those things?  Hi Friend, Please visit the following link: Hope that it will be helpful for you. Thanks
sql component
sql component  is sql package is the component of jdbc
An SQL Locator.
An SQL Locator.  What is an SQL Locator
sql 2000 - SQL
sql 2000  why binary data when inserted into the sql column of data type image or binary is stored in the form of hexadecimal nos. instead of the name of the file inserted????? Thanx for ur response in advance
learn sql - SQL
learn sql  how to learn sql......idont know anything about programming knowledge  Hi Friend, Please visit the following link: Thanks
auto sql script - SQL
auto sql script  Is there a way of generating inserts scripts using the table structure for oracle database
Java Spring Hibernate Struts Training Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile? How to create first Java Program? Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include?


Advertisement null