Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners java servlet connectivity problem with access
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


meer
java servlet connectivity problem with access
1 Answer(s)      a year and 11 months ago
Posted in : Java Beginners


Import java.sql
javax.servlet

//all packages entered
try {
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:CUSTOMER");
           Statement st=con.createStatement();
// Execute an SQL query, get a ResultSet
ResultSet  rs = st.executeQuery("SELECT NAME, ADDRESS FROM CUSTOMER");
// Display the result set as a list
}
catch(.......){}

ERROR MSG on cmd


DBPhoneLookup.java:26: incompatible types
found   : java.sql.Connection
required: Connection
           Connection con = DriverManager.getConnection("jdbc:odbc:CUSTOMER");
                                                       ^
DBPhoneLookup.java:27: cannot find symbol
symbol  : method createStatement()
location: class Connection
           Statement st=con.createStatement();
                           ^

i am confused what is the problem with this part of code

Advertisement
View Answers

January 28, 2013 at 12:07 PM


hi friend,

I think you should check the line of importing package of sql probably there may be a problem. Java is a case sensitive language. In your sample code I can see that you have used the Import java.sql instead of

import java.sql.Connection;

if the problem is not occurred due to the above reason probably there may be a problem in naming of a class. Check whether you have created a class by name "Connection" in your package

for detail tutorial you can go through the link Database Connectivity in Servlet



Related Tutorials/Questions & Answers:
java servlet connectivity problem with access
java servlet connectivity problem with access  Import java.sql javax.servlet //all packages entered try { Class.forName...=con.createStatement(); ^ i am confused what is the problem
connectivity with access
connectivity with access  how to connect with data base with access...; Is this Access database or excel sheet. Do you want to display the values...;Is this Access database or excel sheet. Do you want to display the values in Textarea
Advertisements
connectivity problem
connectivity problem  i am facing error in Class.for name statement... connectivity still i am facing this error* ================================oracle connectivity program============================ import java.sql.*; import
J2ME connectivity to ms access
J2ME connectivity to ms access  How to establish client server connectivity to access ms access database on the server side? I have made the odbc connection. Plz help me in the coding part.. Dont know how to start
Java servlet sql connectivity error - JSP-Servlet
Java servlet sql connectivity error  Hi, I have been trying to connect to sql database via the servlet program in java.I have not been successful so far. However when i try to connect to sql through a normal java program
Access 2007 database connectivity
source and destination. pls tell me the code of connectivity with access 2007...Access 2007 database connectivity  i design an application form that have two JComboBox as the label(source,destination) and two JButton save
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**  <p>...; data sources. 2)Click Add button and select the driver Microsoft Access Driver
oracle connectivity problem with netbeans
oracle connectivity problem with netbeans  sir I am using oracle.... for this after adding new driver(ojdbc6.jar) in services tab I got connectivity with oracle... of simple connectivity with oracle in this I am giving driver details
database connectivity problem
database connectivity problem  what if client dont have database with them then what is other way to run successfully our programm   Please visit the following link: http://www.roseindia.net/jdbc
jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle
Java Servlet Problem - JSP-Servlet
Java Servlet Problem  I have a servlet class that implemets..., but in the attributeReplaced() method, i want to perform a redirect to another servlet... method. Please help!!  Hi friend, Please explain problem
Problem with JRadioButton and Access Database - Java Beginners
Problem with JRadioButton and Access Database  Hello sir ,Here I have write following code to save text on JradioButton but this is not saved in Access Databse, I want to store course type in to database and also other fields
java connectivity
java connectivity  hi........ Can u help me to do connectivity between java and weka??????? weka is a data mining tool which allows to do prediction, classification etc.... i want to do connectivity between weka and java can u
Java connectivity with MySQL
Java connectivity with MySQL  Java connectivity with MySQL
audio files in jdbc connectivity with ms-access - JDBC
audio files in jdbc connectivity with ms-access  i need to know how to retrieve audio files through jdbc connectivity with ms-access and how to play... static void main(String[] args) { try{ String url="jdbc:odbc:access"; File
Java Problem - JSP-Servlet
Java Problem  What are the steps to run a java Servlet program.with examples  Hi Friend, Please visit the following link: http://www.roseindia.net/servlets/index.shtml Thanks
java connectivity
java connectivity  i am trying to add dyanamic rows in the jsp page, when i add the new row the dropdown control value is not coming from database..please help me to overcome this problem
Java Problem - JSP-Servlet
Java Problem  How to run a Simple JSP program ? what steps are necessary  Hi Friend, Steps: 1)First of all you need to install Tomcat on your system. 2)Then put your tomcat folder inside the C drive. 3)Set
how to solve this problem for oracle connectivity
how to solve this problem for oracle connectivity  Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap ter could not establish the connection
Problem with Double type Value in Access Database - Java Beginners
Problem with Double type Value in Access Database  Hello sir I have store Double Type Value in MS Access Databse,but when I search Record... Mobile Number with MS access Database,plz Help Me Sir.   Hi Friend
Servlet compilation problem - Java Beginners
Servlet compilation problem  hi, m a beginner to servlet world... i m facing problem in servlet compilation problem.. i have set the classpath of servlet-api.jar . m using tomcat 6.0 i m unable to compile my servlet program
connectivity - JSP-Servlet
connectivity  hi, im doing a project in bioinformatics.I wish to create a webserver,for that I have to access the datas from a databse file named ProteinDataBank which is already available.I want to know the coding for how
servlet program problem - Java Beginners
servlet program problem   i used ur servlet example prg with xml file of helloworld program and i run dat program in tomcat, it shows only... file to run it  Hi Friend, Please clarify your problem. Thanks
sql connectivity through java
sql connectivity through java  i want an example for java db through sql connection. Thanks in advance
MS Access - JSP-Servlet
in Connectivity in MS Access : import java.sql.*; public class... problem is how to connect MS Acces database with servlets ... thank you...   hai i m kaleeswaran ihave some idea to connect msaccess to servlet
java validation problem - JSP-Servlet
java validation problem  I have created a Registration page.I want... to do this? Can anyone gives the answer for this problem? Thanks in advance... problem. Here is the link http://www.roseindia.net/jsp/user-registration-form
Servlet Problem - Java Interview Questions
Servlet Problem  I need to get an alert message when the submit button is clicked again while processing... how is it possible...?? Thanks in advance
Database connectivity with jsp code - JSP-Servlet
Database connectivity with jsp code  I have written a program in java having connectivity with online_exam. Its working properly. Connection has been established and the code in java is showing the output. But the problem
How to Open Picture From M.S. Access Database using Java Servlet ?
How to Open Picture From M.S. Access Database using Java Servlet ?  ... Database But i m still not able to open this picture through Java using M.S. Access and i wants to open this Picture On Web Browser using Java Servlet anybody can
JDBC, Java Database Connectivity
tutorials. Java Database Connectivity or JDBC for short is Java bases API... driver as per your application needs. About JDBC Java Database Connectivity... in developing Java programs that access the database are mentioned below
Java to SQL Server Connectivity
Java to SQL Server Connectivity  Hi, heres my code private void... with sql server connectivity at the background to save the data. Now, after... the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you
Advertisements
 

 

 

DMCA.com