Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

connectiondetails from vibhu



Share on Google+Share on Google+

connectiondetails from vibhu
1 Answer(s)      4 years and a month ago
Posted in : JDBC

how to create connection?

View Answers

May 22, 2013 at 11:23 AM

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
package com.tcs.ignite.connection;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

 * @author ignite234
public class Connectiondetails {

    private String url = "jdbc:mysql://localhost:3306/";
    private String schema = "saibaba";
    private String userName = "root";
    private String password = "root";
    public Statement statement = null;
    public Connection connection = null;
    public ResultSet resultSet = null;

    public void openConnection() {
        try {
            try {
                DriverManager.registerDriver(new com.mysql.jdbc.Driver());
            } catch (SQLException e) {
                System.out.println("MySQL connection error: " + e.getMessage());
            connection = (Connection) DriverManager.getConnection(url + schema, userName, password);
            statement = (Statement) connection.createStatement();
        } catch (SQLException ex) {
            Logger.getLogger(Connectiondetails.class.getName()).log(Level.SEVERE, null, ex);

    public void closeConnection() {
        try {

        } catch (SQLException ex) {
            Logger.getLogger(Connectiondetails.class.getName()).log(Level.SEVERE, null, ex);


Related Tutorials/Questions & Answers:
connectiondetails from vibhu
connectiondetails from vibhu  how to create connection?   /* * To change this template, choose Tools | Templates * and open the template... Connectiondetails { private String url = "jdbc:mysql://localhost:3306
Deploy .war from From NetBeans
Deploy .war from From NetBeans  How to deploy .war file into external running application server directly from Netbeans just as from eclipse
Text From Your Clipboard?
Text From Your Clipboard?  Text From Your Clipboard
download code from database
download code from database  how to download files from database
Load UIImage from URL
Load UIImage from URL  Load UIImage from URL
calling servlet from jsp
calling servlet from jsp  how to call a servlet from jsp
Buses from Delhi to Agra
Buses from Delhi to Agra  From where i can catch buses from Delhi to Agra? Thanks
Show a hidden frame previously from another from
Show a hidden frame previously from another from  How can i show a hidden frame previously by this code: jframe_name.hide(); and make it visible from another frame i'm waiting for the answer, and i'll be thankfull
Extarct string from PDF
Extarct string from PDF  how can i search a particular character from pdf? also extarct string from a pdf document
delete an item from database
delete an item from database  how to delete an item from the database using jsp
delete app from iphone
delete app from iphone  How to delete an existing app from itunes
NSArray from NSMutableArray
NSArray from NSMutableArray  HI, How to make NSArray from NSMutableArray? Thanks
Get GMT from IP
Get GMT from IP  How do I get GMT value from IP address?? Thanx in Adv
ffmpeg audio from video
ffmpeg audio from video  Hi, How to extract audio from a video file? Thanks
Subtraction of a date from Sql and other from java.
Subtraction of a date from Sql and other from java.  I want to subtract a date that i retrieve from mysql database with the system date that i retrieve from java. I want the difference between the two date in the integer form
connect to the database from JSP
connect to the database from JSP  How do you connect to the database from JSP?   A Connection to a database can be established from a jsp page by writing the code to establish a connection using a jsp scriptlets
create pdf from jsongrid
create pdf from jsongrid  i need to create pdf from jsongrid in java struts2.. otherwise i need to create pdf from result set
Acess Record from database.
Acess Record from database.  How to access records from database and how to display it on view page, with the help of hibernate
RADIO FROM JSP TO ACTION.  Hi frds, how to get the selected multiple radio button values from jsp to action
getting coords from an image.
getting coords from an image.  how to get coordinates dynamically(in run time) from an image?? pls help me
Run a .exe from a class
Run a .exe from a class  how to lauch a .exe file from a class in Java and to check the success ful execution of the same
searching from database
searching from database  how to search data from data base throug search...such as contact no./lastname /firstname should give whole information from database...   Please visit the following link: Servlet search
Session Object from request
Session Object from request  Why are we getting session object from... getting cookie object from request object? I know all methods are available its relevant class. is there any reason for getting session object from request
extract data from HTML
extract data from HTML  how to write the coding for to extract data from html tags like(h3,p) and then extracted data should be stored in data base? can anybody tell me how to write the coding
sms from pc to mobile
sms from pc to mobile  Sir I am developing a website and i need a code to send sms on any mobile from the wbesite.pls help me. thanx in advance
Dashboard from MogoDB
Dashboard from MogoDB  Hi Friends I need to develop a dashboard which will retrieve the data from MogoDB and show it in a web page. Which is the best way to do
Data from multiple ResultSets?
Data from multiple ResultSets?  hello, How can I get data from multiple ResultSets?   Hi, You can iterate the ResultSet separately and get the required data. Thanks
nsstring load from file
nsstring load from file  Hi, How to load file data into NSString object? Example of nsstring load from file, basically the html file data into NSSTring object. Thanks
XmlBeanFactory is depricated from spring3.0
XmlBeanFactory is depricated from spring3.0  XmlBeanFactory is depricated from spring3.0 So how to load Sping config   Have a look at the following tutorial:
pdf generate from jsp
pdf generate from jsp  how do i generate a pdf using jsp that should query the data from the database and write it into a pdf and download the same