How Jdbc program can be run??

Ads
 

How Jdbc program can be run??

import java.sql.*; import java.util.*; class MyDbCode3 {

public static void main(String [] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException cnf) { System.out.println("Cannot load the Driver"); System.exit(1); } Scanner kb=new Scanner(System.in); int id; System.out.println("Enter bookid:"); id=kb.nextInt(); try { Connection conn=DriverManager.getConnection("jdbc:odbc:advdsn1","student","myself"); Statement st=conn.createStatement(); String qry="Update mybooks set price=price+1000 where bookid="+id; System.out.println(qry); int x=st.executeUpdate(qry); System.out.println("Rows effected="+x); conn.close(); } catch(SQLException sq) { System.out.println("Sql Error:"+sq.getMessage()); } } }

I have created Dsn Successfully ,table also has been created successfully and when i compiled this program then it compiled successfully ,but when i run it ,it gives following error->

C:\Program Files\Java\jdk1.5.0\bin>java MyDbCode3 Enter bookid: 101 Sql Error:[Microsoft][ODBC Driver Manager] Data source name not found and no def ault driver specified

i want to know what is the problem? and how can i run it successfully? please give me a satisfieng answer ,bcz i am not satisfied by ur previous answer...

thank u ....

View Answers

Ads









Related Tutorials/Questions & Answers:
How Jdbc program can be run??
how to run jdbc program in linux-ubuntu?
Advertisements
how to run jdbc program in linux-ubuntu?
how to run jdbc in jsp program - JSP-Servlet
how can i write this program ?please suggest me
jdbc program
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code - JDBC
Jdbc and Socket Program - JDBC
execution of a jdbc program
how can create pop() method in this program ,Or how can delete image in it when i press pop button in runtime ??? please help me ...
How can I write a GUI stack program by Java to push Image files instead of other data type items?
all sequences to create jdbc and how can i use jtable to display a single columns or multiple columns
java program - JDBC
How to download MySQL JDBC driver?
regarding connectivity program only - JDBC
Java Program - JDBC
Java Program - JDBC
JDBC Oracle program
how to connect mysql with JDBC - JDBC
jdbc connection to java program code - JDBC
Java Program - JDBC
Java Program - JDBC
regarding connectivity program only - JDBC
Jdbc Program for building Student Information Database - JDBC
how to run rmi program
how to run this program?
how should i can solve
How to write Java Program
how to creat a new program
How can I to my database to my application

Ads