User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,789 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 994 | Replies: 0
Reply
Join Date: Dec 2007
Posts: 1
Reputation: shikhu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shikhu shikhu is offline Offline
Newbie Poster

Help Database connectivity to ms-access

  #1  
Dec 3rd, 2007
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Registering driver type
Connection con=DriverManager.getConnection("jdbc:odbc:proj"); // Assigning drivermanager
con.setAutoCommit(true);
//String str="insert into dovetail values('"+id+"','"+a+"','"+b+"','"+res+"')";
String str="insert into dovetail values('ASDF','Raj','1234','198')";
Statement stmt=con.createStatement(); // creating statement object
int ret=stmt.executeUpdate(str);
System.out.println(ret);
if(ret==0)
{
System.out.println("Not Inserted");
}
else
{
System.out.println("Data Inserted Successfully");
}
/*str="select * from dovetail";
ResultSet resl=stmt.executeQuery(str);
boolean val=resl.next();
while(val)
{
//System.out.println(resl.getString(1));
val=resl.next();
}*/
System.out.println("Completed");



the following i used to update the ms-access. when i try to insert its not getting update but when i remove the commented code i,e when i retrieve the data it is getting updated.. can any one help me out.....
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 9:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC