Results 1 to 2 of 2
  1. #1
    shaungoater is offline Member
    Join Date
    Nov 2007
    Rep Power

    Default SQL Insert Help!!!!

    I am using the following line of code to insert values into a database...

    Java Code:
                        String sql, imagePath= s;
                        // First, tell Java what driver to use and where to find it.
                        // 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){
                    } catch(SQLException e){
    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

  2. #2
    ferranb is offline Member
    Join Date
    Jun 2008
    Rep Power


    Which database are working on? Have you validate it from another software?

Similar Threads

  1. How can i insert a char into a string
    By Jamie in forum New To Java
    Replies: 8
    Last Post: 02-17-2011, 08:59 PM
  2. Replies: 3
    Last Post: 07-12-2010, 07:15 AM
  3. How to insert graph in java
    By valery in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 08:38 PM
  4. How do insert a Graphic
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 05:30 AM
  5. how to insert tables into JTextPane
    By osval in forum AWT / Swing
    Replies: 1
    Last Post: 07-29-2007, 09:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts