How Jdbc program can be run??

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









Related Tutorials/Questions & Answers:
How Jdbc program can be run??
ModuleNotFoundError: No module named 'runez'
Advertisements
ModuleNotFoundError: No module named 'runai'
ModuleNotFoundError: No module named 'runai'
ModuleNotFoundError: No module named 'runnb'
ModuleNotFoundError: No module named 'runnb'
ModuleNotFoundError: No module named 'runin'
ModuleNotFoundError: No module named 'riemann-runit'
ModuleNotFoundError: No module named 'RunDB-client'
ModuleNotFoundError: No module named 'runge_kutt'
ModuleNotFoundError: No module named 'RunDB-client'
ModuleNotFoundError: No module named 'runge_kutt'
ModuleNotFoundError: No module named 'scikit-learn_runnr'
ModuleNotFoundError: No module named 'pycopy-runpy'
ModuleNotFoundError: No module named 'micropython-runpy'
ModuleNotFoundError: No module named 'project_runpy'
ModuleNotFoundError: No module named 'DO_runin'
ModuleNotFoundError: No module named 'py-wave-runup'
ModuleNotFoundError: No module named 'py-wave-runup'
ModuleNotFoundError: No module named 'RuNAs'
ModuleNotFoundError: No module named 'RuNAs'
ModuleNotFoundError: No module named 'django-runas'
ModuleNotFoundError: No module named 'aws-runas'
ModuleNotFoundError: No module named 'django-runas'
how to run jdbc program in linux-ubuntu?
how to run jdbc program in linux-ubuntu?
how to run jdbc in jsp program - JSP-Servlet
jdbc program
Jdbc and Socket Program - JDBC
execution of a jdbc program
java program - JDBC
Java Program - JDBC
JDBC Oracle program
how can i write this program ?please suggest me
Java Program - JDBC
Java Program - JDBC
Java Program - JDBC
regarding connectivity program only - JDBC
jdbc connection to java program code - JDBC
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 Program for building Student Information Database - JDBC
regarding connectivity program only - JDBC
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 ...
write a program for complete JDBC based application
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
how to connect mysql with JDBC - JDBC
How to download MySQL JDBC driver?
how to run this program?

Ads