views:

39

answers:

1

I have created a user dsn named "harshi"
To insert rows in a table getting data from Java code I want to insert in SQL table. The connection statement is:

String url = "jdbc:odbc:Harshi"; 
Connection conn = DriverManager.getConnection(url,"",""); 
Statement st = conn.createStatement(); 

Still I am getting output as:

Got an exception!
[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied.

How can I solve it?

+1  A: 

To troubleshoot this error, try one of these:

  • does the DSN contain good credentials?
  • If using SQL Server Authentication, try logging in using those exact credentials via SQL Server Management Studio
  • If using Windows Authentication, does the account making the request have permissions to the SQL Server?
  • Are there any firewalls in between the application machine and the database machine?
  • Has the IP address of the destination machine changed since the DSN was created?
  • Try deleting & recreating the DSN.
p.campbell