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

Home Answers Viewqa JDBC Connectivity with sql in detail

Have Programming Question? Ask it here!

Connectivity with sql in detail
1 Answer(s)      4 years and 11 months ago
Posted in : JDBC

View Answers

September 5, 2009 at 2:18 PM

Hi Friend,

Put mysql-connector-java-5.0.5.jar in the lib folder of jdk and try the following code:

import java.sql.*;

public class MysqlConnect{
public static void main(String[] args) {
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "jdbctutorial";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";
try {
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
System.out.println("Disconnected from database");
} catch (Exception e) {

For more information,visit the following link:


Related Tutorials/Questions & Answers:
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou.  Hi Friend, Put mysql-connector
sql connectivity through java
sql connectivity through java  i want an example for java db through sql connection. Thanks in advance
Java to SQL Server Connectivity
with sql server connectivity at the background to save the data. Now, after...Java to SQL Server Connectivity  Hi, heres my code private void... the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you
DataBase connectivity in java with Microsoft sql server2000 - JDBC
DataBase connectivity in java with Microsoft sql server2000  How i can achieve database connectivity with Microsoft sql server2000 in my java source code
jsp sql server 2005 connectivity
jsp sql server 2005 connectivity  your jsp mysql tutorial is very help full.Please tell me how to connect jsp with SQL server 2005
jsp page connectivity with oracle - SQL
jsp page connectivity with oracle  I am unable to database connectivity jsp with oracle. Please send the code for solving problem. thanks  Hi Friend, 1)Import the packages: 2)Load the oracle driver
Java servlet sql connectivity error - JSP-Servlet
Java servlet sql connectivity error  Hi, I have been trying to connect to sql database via the servlet program in java.I have not been successful so far. However when i try to connect to sql through a normal java program
database connectivity
database connectivity  how to create database connectivity between HTML and sql server2005
connectivity with mysql
connectivity with mysql  if this code of roseindia doesnt work,then what to do..cant connect with my sql
iPhone Detail Disclosure Button
iPhone Detail Disclosure Button In iPhone based applications, detail... it .. it'll bring up the detail information about the item in list. We can also say... that will show you CheckMark instead of detail indicator. "cell.accessoryType
database connectivity
database connectivity  describe java program steps in order to get connectivity to database along with example
connectivity with php
connectivity with php  i have make one html form and doing connectivity with php database but when i click on submit button on html form display all coding in php form about connectivity instead of adding data, i used in html
JDBC, Java Database Connectivity
tutorials. Java Database Connectivity or JDBC for short is Java bases API used to interact with the major databases like Oracle, MySQL, Postgresql, SQL... driver as per your application needs. About JDBC Java Database Connectivity
connectivity step
connectivity step  sir.pls give me step one by one for connect the java program to oracle.   Follow these steps: 1) Import the following...", "rose", "rose"); Statement st = conn.createStatement(); ResultSet rs = sql
java connectivity
java connectivity  hi........ Can u help me to do connectivity between java and weka??????? weka is a data mining tool which allows to do prediction, classification etc.... i want to do connectivity between weka and java can u
connectivity problem
connectivity problem  i am facing error in Class.for name statement... connectivity still i am facing this error* ================================oracle connectivity program============================ import java.sql.*; import
Java connectivity with MySQL
Java connectivity with MySQL  Java connectivity with MySQL
file in environment variable.   Java Mysql connectivity Other JDBC
connectivity with access
connectivity with access  how to connect with data base with access sheet. in my application form there is two JTextArea and Two JComboBox.   Is this Access database or excel sheet. Do you want to display the values
connectivity - JDBC
connectivity  How can we connect sql server using Java   Hi Friend, By using JDBC drivers, you can connect SQL server with java. Please visit the following link:
connectivity Other JDBC Tutorials
in connectivity - Hibernate
insertted  Hi friend, This is connectivity and hibernate configuration
DB connectivity - EJB
DB connectivity  DB connectivity
how to send contact detail in email
how to send contact detail in email  hi...all of u.....i am work in jsp..i m new developer...i have create a my company website... than i have one problem...frnd how to send a contact form detail mail on a click submit button
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
I want detail information about switchaction? - Struts
I want detail information about switch action?  What is switch action in Java? I want detail information about SwitchAction
Validate telnet connectivity
Validate telnet connectivity  How to validate telnet connectivity in my java code
Sql  how to find maximum of a101,a102,a103 from a table in sql
about Detail file path where to store application.
about Detail file path where to store application.  can you tell me detail path where we have to store our application
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
jdbc connectivity to mysql tutorial
jdbc connectivity to mysql tutorial  here is complete jdbc connectivity to mysql tutorial for newbies. Person who don't even know how to install mysql and don't know about which driver to use can do with ease
J2ME connectivity to ms access
J2ME connectivity to ms access  How to establish client server connectivity to access ms access database on the server side? I have made the odbc connection. Plz help me in the coding part.. Dont know how to start
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
oracle connectivity problem with netbeans
oracle connectivity problem with netbeans  sir I am using oracle.... for this after adding new driver(ojdbc6.jar) in services tab I got connectivity with oracle... of simple connectivity with oracle in this I am giving driver details
Eclipse Connectivity - JDBC
Eclipse Connectivity  Hello Friends.. I want to do connectivity... connectivity..and which plugins are required for it. i have try to do connectivity but i got given below error. "Error Occured Error
database connectivity problem
database connectivity problem  what if client dont have database with them then what is other way to run successfully our programm   Please visit the following link:
j2me mysql connectivity
j2me mysql connectivity  I do a project on reservation using j2me. I need a connectivity to a MYSQL database. How do I do this Thanks and regards Karthiga
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