Wednesday, 2 October 2013

#EANF#

#EANF#

Can anyone explain me how to connect Java with MySQL?
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
Connection conn = null;
...
try {
conn =
DriverManager.getConnection("jdbc:mysql://localhost/test?" +
"user=monty&password=greatsqldb");
}
catch (SQLException ex)
{
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
This is how i made it but mine is windows authintication and not sql
server authentication. So how to complete the connection with windows
authentication??

No comments:

Post a Comment