HOW TO RUN JDBC PRORAM ON JDK1.5.0
import java.sql.*;
import java.util.*;
class MyDbCode3*
{
public static void main(String [] args)
{
try `print("code sample");`
{ `print("code sample");`
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());
}
}
}
****for running this program i am using jdk1.5.0`*print("code sample");*`
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
Post***
View Answers
March 28, 2011 at 5:23 PM
1)create database and table
2)write the java code
3)provide ODBC connection
4)execute your code...
Ads
Related Tutorials/Questions & Answers:
HOW TO RUN JDBC PRORAM ON JDK1.5.0
HOW TO
RUN JDBC PRORAM ON
JDK1.5.0 import java.sql.*;
import... driver specified
i want to know what is the problem? and
how can i
run...
{
Connection conn=DriverManager.getConnection("
jdbc:odbc:advdsn1","student","myself
How Jdbc program can be run??
How Jdbc program can be
run?? import java.sql.*;
import java.util.... to know what is the problem? and
how can i
run it successfully?
please give me...
{
Connection conn=DriverManager.getConnection("
jdbc:odbc:advdsn1","student","myself
Advertisements
how to run jdbc program in linux-ubuntu?
how to
run jdbc program in linux-ubuntu?
how to
run jdbc program in linux-ubuntu?
hi
firstly download the jdk on your system using terminal or go to softwear management then download openjdk-6
or
commandline
how to run this program?
how to
run this program?
how to
run java swing program
Java Swing program runs same as a simple java program. There is no difference... with javac and
run with java command, same as a simple java program.
Learn Swing
How to compile and run the JSP
How to compile and
run the JSP Hi
Kindly tell me
how to
run and compile JSP small Program using Tomcat as webserver.
I created small program HELLO JSP in HTML and compile the program but it is saying Class o r interface
how to run java program
how to
run java program i have jar file.
in jar i have so many classes.in one of file i want modify .after modifying file i want replce in jar.
please help me to
how to generate class and
how to replace
how to run a applet from browser
how to
run a applet from browser hi,
iam sending the code of an applet.
it is working in cmd prompt,but not working from browser.
<APPLET CODE... Random();
try
{
String connectionURL = "
jdbc:mysql://localhost:3306/mysql
How to run JSP program inEclipse?
How to
run JSP program inEclipse? Hi,
I am learning JSP. I want to
run JSP in Eclipse.
How to
run JSP program inEclipse?
Thanks
Hi,
Its easy to
run JSP from the Eclipse. You have to make a dynamic web application
how to compile and run servlet program
how to compile and
run servlet program hello sir/mam i hve installed tomcat5.5 version and also have jdk1.6.0_14 installed but not able to
run it or compile i m doing it first tyme pls help me in sorting out this problem.
i hve
How to compile and run Java program
How to compile and
run Java program
How to compile and Java program from command prompt on my windows 7 computer?
Thanks
Hi... is not installed your computer, learn
how to install and configure Java on windows 7
How to run external command in Python?
How to
run external command in Python? Hi,
I am writing an application in Python and there is requirement of calling the external command from... external command.
How to
run external command in Python?
Thanks
Hi
How to run program in new opened cmd
How to
run program in new opened cmd Hello i have made a program in java to open command prompt, then
how to
run my left of the program in the new opened command prompt
how to run a java program using run.exec()?
how to
run a java program using run.exec()? Hi..i want to compile and
run a java file using run.exec().i.e., without compiling and running from command prompt i want to do them in the program itself.I am able to compile
How to run PHP Script from the command line ?
How to
run PHP Script from the command line ? Running PHP Script from the command line
Actually it is very simple to
run php script command line. Except there are a few things that are different, for example
how to run java application with out stoping
how to
run java application with out stoping I have one java application to download some pdf file but its going to stop downloading after some time it not giving any errors any thing can any one help me to solve this problem
How to call the run method from another class?
How to call the
run method from another class? Sorry, if this is a stupid question.
I would like to find out
how to call the
run method...
run() {
new FereastraPrincipala().setVisible(true);
from the class
how to resolve this JDBC Error?
how to resolve this
JDBC Error? i am trying to Exceute this code:
import java.sql.DatabaseMetaData;
import java.sql.Connection;
import... = "oracle.jdbc.driver.OracleDriver";
String dburl = "
jdbc:oracle:oci:@localhost
JDBC Transaction Example
is the video tutorial which shows you
how to
run the code example with
instruction.
How to manage transaction in
JDBC?
Then Write the Following...
JDBC Transaction Example
JDBC Transaction
JDBC transaction is used
How to download MySQL JDBC driver?
How to download MySQL
JDBC driver? Hi,
What is
JDBC Driver?
How to download MySQL
JDBC driver?
Thanks
Hi,
JDBC - Java database... program. To connect to MySQL database from Java program we need
JDBC Driver of MySQL
How to run a Java program in CMD
There are multiple ways to write and
run Java programs. In this article we
discussed
how to write and
run Java program in CMD.
Tips to
run Java program....
Cd \myproject and press enter. It will change the folder.
Run the dir
how to connect jdbc
how to connect jdbc package com.tcs.ilp.Try.Controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import
How to run java swing application from jar files .
How to
run java swing application from jar files . Hello Sir... setup file .As per my knowledge i have to
run .jar file from dist folder of netbeans but when i am trying to
run from there i am getting error "Could not find
how can i run ASP.Net Server from netbeans IDE?
how can i
run ASP.Net Server from netbeans IDE? please help me
how can i
run ASP.Net Server from netbeans IDE?
in other word , I have a web services published with IIS7 and I want to use it from my Application
My Application