I want to set up a connection to a Microsoft SQL Server 2005 express on my PC.
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:mysql://localhost/db1","xxxx","yyyy");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT nume FROM tabel1");
while (rs.next()) {
String s = rs.getString("name");
textArea.append(s);
}
}
// Catches any error conditions
catch (SQLException e)
{
System.out.println("connection DEAD");
}
catch (java.lang.ClassNotFoundException x)
{
System.out.println("class not found");
}
About the SQL server, I can only connect to it from the Management Studio via Windows authentication. "PCNAME\Administrator" user and no password. I've tried adding logins but no use.
What to do ?