Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-20-2008, 12:04 PM
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-14-2008, 04:14 AM
Member
 
Join Date: Jun 2008
Posts: 21
ferranb is on a distinguished road
Which database are working on? Have you validate it from another software?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert graph in java valery Advanced Java 1 08-06-2007 09:38 PM
How do insert a Graphic carl New To Java 1 08-01-2007 06:30 AM
how to insert tables into JTextPane osval AWT / Swing 1 07-29-2007 10:11 AM
org.hibernate.exception.GenericJDBCException: could not insert Peter Database 2 07-04-2007 03:00 PM
How can i insert a char into a string Jamie New To Java 2 05-20-2007 10:01 PM


All times are GMT +3. The time now is 07:37 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org