Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Decompiled with CFR 0_115.
- */
- import java.io.PrintStream;
- import java.sql.Connection;
- import java.sql.DatabaseMetaData;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class conectaDB {
- public static void main(String[] args) {
- Connection conn = null;
- try {
- try {
- String dbURL = "jdbc:sqlserver://localhost\\sqlexpress";
- String user = "prueba";
- String pass = "Ab123.*";
- conn = DriverManager.getConnection(dbURL, user, pass);
- if (conn != null) {
- DatabaseMetaData dm = conn.getMetaData();
- System.out.println("Driver name: " + dm.getDriverName());
- System.out.println("Driver version: " + dm.getDriverVersion());
- System.out.println("Product name: " + dm.getDatabaseProductName());
- System.out.println("Product version: " + dm.getDatabaseProductVersion());
- }
- }
- catch (SQLException ex) {
- ex.printStackTrace();
- try {
- if (conn != null && !conn.isClosed()) {
- conn.close();
- }
- }
- catch (SQLException ex) {
- ex.printStackTrace();
- }
- }
- }
- finally {
- try {
- if (conn != null && !conn.isClosed()) {
- conn.close();
- }
- }
- catch (SQLException ex) {
- ex.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement