connectiondetails from vibhu



Share on Google+Share on Google+

connectiondetails from vibhu
1 Answer(s)      3 years and 11 months 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
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
calling servlet from jsp
calling servlet from jsp  how to call a servlet from jsp
Load UIImage from URL
Load UIImage from URL  Load UIImage from URL
download code from database
download code from database  how to download files from database
Text From Your Clipboard?
Text From Your Clipboard?  Text From Your Clipboard
Buses from Delhi to Agra
Buses from Delhi to Agra  From where i can catch buses from Delhi to Agra? 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
Extarct string from PDF
Extarct string from PDF  how can i search a particular character from pdf? also extarct string from a pdf document
NSArray from NSMutableArray
NSArray from NSMutableArray  HI, How to make NSArray from NSMutableArray? Thanks
delete app from iphone
delete app from iphone  How to delete an existing app from itunes
ffmpeg audio from video
ffmpeg audio from video  Hi, How to extract audio from a video file? Thanks
Get GMT from IP
Get GMT from IP  How do I get GMT value from IP address?? Thanx in Adv
delete an item from database
delete an item from database  how to delete an item from the database using jsp
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
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
getting coords from an image.
getting coords from an image.  how to get coordinates dynamically(in run time) from an image?? pls help me
RADIO FROM JSP TO ACTION.  Hi frds, how to get the selected multiple radio button values from jsp to action
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
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
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
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
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
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
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
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:
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
Java Spring Hibernate Struts Training java.lang.classnotfoundexception com.mysql.jdbc.driver how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu


Advertisement null