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

Ads









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 'runin'
ModuleNotFoundError: No module named 'runnb'
ModuleNotFoundError: No module named 'riemann-runit'
ModuleNotFoundError: No module named 'DO_runin'
ModuleNotFoundError: No module named 'runge_kutt'
ModuleNotFoundError: No module named 'RunDB-client'
ModuleNotFoundError: No module named 'runge_kutt'
ModuleNotFoundError: No module named 'RunDB-client'
ModuleNotFoundError: No module named 'scikit-learn_runnr'
ModuleNotFoundError: No module named 'micropython-runpy'
ModuleNotFoundError: No module named 'project_runpy'
ModuleNotFoundError: No module named 'pycopy-runpy'
ModuleNotFoundError: No module named 'py-wave-runup'
ModuleNotFoundError: No module named 'py-wave-runup'
how to run jdbc program in linux-ubuntu?
ModuleNotFoundError: No module named 'RuNAs'
ModuleNotFoundError: No module named 'RuNAs'
how to run jdbc program in linux-ubuntu?
ModuleNotFoundError: No module named 'aws-runas'
ModuleNotFoundError: No module named 'django-runas'
ModuleNotFoundError: No module named 'django-runas'
jdbc program
Jdbc and Socket Program - JDBC
execution of a jdbc program
how can i write this program ?please suggest me
JDBC Oracle program

Ads