Skip to content

Instantly share code, notes, and snippets.

@nugraha16
Created June 6, 2012 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nugraha16/2880515 to your computer and use it in GitHub Desktop.
Save nugraha16/2880515 to your computer and use it in GitHub Desktop.
Hospitalization Information System applications with the SMS Gateway
package newbieilmu.rawatinap;
import javax.swing.*;
import java.sql.*;
public class Koneksi
{
public Koneksi()
{
}
public Connection open_a_Connection() throws SQLException
{
Connection connect= null;
try
{
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/db_rawatinap","root","root");
return connect;
}
catch(SQLException ex)
{
JOptionPane.showMessageDialog(null,"Tidak ada koneksi yang terbuka"+ ex,"informasi",JOptionPane.INFORMATION_MESSAGE);
return null;
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Tidak dapat membuka koneksi yang terbuka","informasi",JOptionPane.INFORMATION_MESSAGE);
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment