[Solved] connecting to sql database in java [closed]


Problem is in your odbc connection

goto ControlPanel->AdministrativeTools->DataSource(ODBC)->System DSN->ADD->SqlServer->

then in the name field give the Source Name.

you have to use this name instead of testdb in your DriverManager.getConnection method.

Because getConnectionMethod take the source name not the database name. so your code is not working.

However after filling the source name fill the server field with your server.Then you will be asked to bind the database for the source connection and set your database name.Hopefully you are done.

solved connecting to sql database in java [closed]