Thursday, 9 February 2017

Connection of Database with Mysql & Oracle in java. JDBC Type 2 Connection

*Here is link to download Jar File





*How to add External Jar in netbeans ans Eclipse.

Netbeans:                                               Eclipse:

>Right Click on Project.             >Right Click on project.
>Click on properties.                  >Java Build Path.
>Click on Libraries.                    >Add External Jars.
>Add/Jar Folder.

*Driver Class

Oracle: oracle:jdbc:driver:OracleDriver
Mysql: com.mysql.jdbc.Driver

*URL path

 Oracle: jdbc:oracle:thin:@localhost:1521:XE

 Mysql:jdbc:mysql://localhost:3306

*DataBase Engine Download link





Code:

import java.sql.*;
public class msqlTest {
    
    public static void main(String args[]) throws Exception
    {
        String url="jdbc:mysql://localhost:3306";
        String userName="root";
        String password="ujash7878";
        
        Class.forName("com.mysql.jdbc.Driver");
        
        Connection con=DriverManager.getConnection(url,userName,password);
        System.out.println("Done");
        
       }
    
    

}

Practical 11 Doc File Link:https://drive.google.com/file/d/0By7E21gumtOVT0NGVF9KLU91dGM/view?usp=sharing

Practical 11 Source Code File:https://drive.google.com/file/d/0By7E21gumtOVMmpzeC1BeFhWNk0/view?usp=sharing









Thanks ;)

Happy Coding 



No comments:

Post a Comment