Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Insert Statement with JAVA

807603Nov 6 2007 — edited Nov 7 2007
I'm trying to insert Data into an access table. Moreover, I'm able to retrieve data on the table (to prove that I'm connecting fine)... I just can't insert Data
try
		{
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			Connection con = DriverManager.getConnection(url);
			System.out.println("Connection Successful");

			Statement st = con.createStatement();
			
			ResultSet rs = st.executeQuery("INSERT INTO Worker VALUES ('" + strDataName + "', '" + strDataDept + "', '" + dblDataHoursWrked + "', '" + dblDataHourlyWage + "', '" + dblDataPay + "')");
			rs.close();

			processQuery(con, st); // does what is nessesary to complete the current request
			
			st.close();
			con.close();
		}
		catch (ClassNotFoundException e)
		{
			System.out.println("failed to load OBCD driver. ");
			System.out.println ("Class errros: " + e);
		}
For some reason, I don't have any errors Its just not inserting the data to the table.. any help would be greatly appreciated
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 5 2007
Added on Nov 6 2007
15 comments
824 views