Código PHP:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sql_server;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
*
* @author otto
*/
public class Conexion {
/**
* @param args the command line arguments
*/
public static void crearConexion() {
try {
// Get connection
DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
Connection connection = DriverManager.getConnection("jdbc:sqlserver://localhost:1434;databaseName=practica", "dbo", "");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: " + meta.getDriverName());
System.out.println("Driver Version: " + meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: " + meta.getDatabaseProductName());
System.out.println("Database Version: " + meta.getDatabaseProductVersion());
}
} catch (SQLException se) {
System.out.println("ERROR: " + se.getMessage());
}
}
public static void main(String[] args) {
crearConexion();
}
}
EDITO: He logrado que realize la conexion logueandome con el usuario "sa" que viene por defecto en SQL Server, sin embargo, no agrega ningun registro, es decir, pareciera que carga el driver, pero no conecta con la base :(