View Single Post
  #1 (permalink)  
Old 03-20-2008, 12:04 PM
shaungoater shaungoater is offline
Member
 
Join Date: Nov 2007
Posts: 13
shaungoater is on a distinguished road
SQL Insert Help!!!!
I am using the following line of code to insert values into a database...

Code:
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
Reply With Quote
Sponsored Links