I'm using following code to connect with Sql Server 2008:
Connection con = null;
CallableStatement stmt = null;
ResultSet rs = null;
try
{
SQLServerDataSource ds = new SQLServerDataSource();
ds.setIntegratedSecurity(false);
ds.setServerName("localhost");
ds.setInstanceName("MSSQLSERVER2008");
ds.setPortNumber(1433);
ds.setUser("televic-edu3-dev");
ds.setPassword("internal");
ds.setDatabaseName("televic-edu3-dev");
con = ds.getConnection();
...
It gives me following error:
Login failed for user 'televic-edu3-dev'. The user is not associated with a trusted SQL Server connection.
Mixed mode is enabled on my SqlServer instance. I already tried connecting to my SqlServer instance with the same credentials, which works. In .NET, it does work with a connectionString which has the same credentials... So what am I doing wrong?
This is the connectionString from .NET:
TLV-EDU-LIC\MSSQLSERVER2008;Password=internal;Persist Security Info=True;User ID=televic-edu3-dev;Initial Catalog=televic-edu3-dev
I also tried this by the way, which gives me the same error (which is logical):
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try
{
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"instanceName=MSSQLSERVER2008;databaseName=televic-edu3-dev;
userName=televic-edu3-dev;password=internal;";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl);