0% found this document useful (0 votes)
19 views1 page

Connector

The document describes a Java class called connector that contains a static ConnectDb method to connect to a MySQL database called eye using the root username and blank password, returning the Connection object or null if an exception occurs.

Uploaded by

Cha Ri Na
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Connector

The document describes a Java class called connector that contains a static ConnectDb method to connect to a MySQL database called eye using the root username and blank password, returning the Connection object or null if an exception occurs.

Uploaded by

Cha Ri Na
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

package com.user.

pass;

import java.sql.*;

import javax.swing.*;

public class connector {

Connection conn = null;

public static Connection ConnectDb(){

try{

Class.forName("com.mysql.jdbc.Driver");

Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/eye", "root", "");

return conn;

}catch (Exception e){

JOptionPane.showMessageDialog(null, e);

return null;

You might also like