ProgrammingB52
Technical User
Below is my code and I am getting a connection unsuccessful error. I am trying to use a sql server database. I didn't do anything in the control panel odbc datasources.
try
{
String url = "jdbcdbc:employeeExpense";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbConn = DriverManager.getConnection(url);
msgOut.insert("Connection successful\n", 0);
msgOut.select(0, 0);
}
catch (ClassNotFoundException cnfex)
{
cnfex.printStackTrace();
msgOut.insert("Connection Unsuccessful\n" + cnfex.toString(), 0);
msgOut.select(0, 0);
}
try
{
String url = "jdbcdbc:employeeExpense";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbConn = DriverManager.getConnection(url);
msgOut.insert("Connection successful\n", 0);
msgOut.select(0, 0);
}
catch (ClassNotFoundException cnfex)
{
cnfex.printStackTrace();
msgOut.insert("Connection Unsuccessful\n" + cnfex.toString(), 0);
msgOut.select(0, 0);
}