I am using the following line of code to insert values into a database...
try{
String sql, imagePath= s;
// First, tell Java what driver to use and where to find it.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Next, create a connection to your data source.
// Specify that you are using the ODBC-JDBC Bridge.
// And specify the data source from ODBC.
con = DriverManager.getConnection("jdbc:odbc:Temp");
// Create an SQL statement.
Statement stmt = con.createStatement();
// Execute some SQL to create a table in your database.
// If the table already exists, an exception is thrown!
stmt.executeUpdate("INSERT INTO imageDatabase [path , keyword1] VALUES (+imagePath+,'landscape')");
}
// Catch any exceptions that are thrown.
catch(ClassNotFoundException e){
System.out.println(e.toString());
} catch(SQLException e){
System.out.println(e.toString());
imagePath is a variable. When i run the above code i get the following error.
Data source name not found and no default driver specified