java servlet connectivity problem with access

java servlet connectivity problem with access

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
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
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
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
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
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 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
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
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
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
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
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
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
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 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
connectivity code it works but problem is with servlet page. My servlet code...Servlet problem  Hello, I am very shocked about this mysterious problem from last three month and now i hope rose india developers
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
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
servlet problem
servlet problem  wheni m deploying an servlet application im getting trouble context [/filename] startup failed due to previous error in tomcat 6.0.
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
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
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
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 Problem - JSP-Servlet
Servlet Problem  Hii I am Ajay . I am makin g a project in java using servlets. I have a database in which I have stored images along with some other info(Name, address type). I want to display that info in text form along
Servlet and Access - JDBC
Servlet and Access  How to use RequestDispatcher in servlet to call.... And how to save image in access database cause i am using Microsoft access 2003 so how to save the image file in access Database. please do reply
problem running a servlet on tomcat.
problem running a servlet on tomcat.  i have followed the steps given... to run my servlet that is placed in the directories as it has been mentioned here, the browser responds "HTTP Status 404 - /java_mail/hello" wht could
problem in servlet program
problem in servlet program  Dear Sir, I have a problem to insert the Blob type data like as video file, audio file in the database using Servlet and html code
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
Java Script Code Problem - JSP-Servlet
Java Script Code Problem  how to concatenate html table values(there are 3 rows,each row contains 3 fields) into variable and display it using javascript  Hi Friend, Try the following code: document.write
Java connectivity with MySQL
Java connectivity with MySQL  Java connectivity with MySQL
problem in jsp using ms-access
problem in jsp using ms-access  after starting server(tomcat) wen v... and select the driver Microsoft Access Driver(*.mdb). 3)After selecting... the driver Microsoft Access Driver(*.mdb). 3)After selecting the driver, click
Servlet Problem proceed - JSP-Servlet
Servlet Problem proceed  Thank you fro your reply. But I couldnt find any serious error.Please see this. User is the package classes/User... problem then read more details. http://www.roseindia.net/servlets
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
Jsp ,Servlet Problem - JSP-Servlet
Jsp ,Servlet Problem  hi, m new to jsp n Servlet. i really find ur tricks very effective.Last time u had helped me to connect my java program with oracle. it worked wonders. now i m starting jsp n servlet learning.. pls
MS-ACCESS Query Problem - SQL
MS-ACCESS Query Problem  hi sir i have table which is initially have empty records Deleted Attributes: Roll Name Add Age Course Class... = DriverManager.getConnection("jdbc:odbc:access"); Statement st
Servlet problem - JDBC
Servlet problem  Hii Everyone, I m Ajay. I m making a project using... SQL 2000 database and I have developed a servlet that accepts input from user but however. It gives problem sometimes while at others it works perfectly. I m
Problem in Servlet - Servlet Interview Questions
Problem in Servlet  Sir, I have pointed everything in web.xml, path class path etc.. empController is my main servlet program and I called in form.... then some exception ..Servlet Exception: empContrller is not a servlet pgm
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
logout problem.. - JSP-Servlet
logout problem..  hi... first of all thanks for ur... but their is some problem with the the logout,i m not able to logout when... done in the code i have used session object in project's servlet and jsp
tomcat problem - JSP-Servlet
\java\jre 1.5.0\bin\client\jvm.dll...... and will not proceed further. I... perfectly. Kindly let me know what is the problem at an earliest. Thanking... found your problem.. http://www.roseindia.net/web-application-server/tomcat
problem in programming - JSP-Servlet
problem in programming  Hi! I am new with jsp. I am facing a problem in programming to calculate the time interval between login time and logout time of user
pagination problem - JSP-Servlet
using servlets in that i called a these methods,to call this servlet i created a html file i wrote one form to call this servlet. In this servlet i used doget...(),my problem is that where i have to put & how to do pagination? my code
pagination problem - JSP-Servlet
using servlets in that i called a these methods,to call this servlet i created a html file i wrote one form to call this servlet. In this servlet i used doget...(),my problem is that where i have to put & how to do pagination? my code
servlet problem - Servlet Interview Questions
servlet problem   when i have perform action on submit button then there is no call servlet in my action i have done every effort in this programe... application folder and servlet in classes folder of apache tomcat. The web application
servlet code problem - JSP-Servlet
servlet code problem  This is my JSP code index.jsp Sync... here!!!..., i want to pass the texbox value and file to servlet im stuck with this error plzz help me..., in servlet if i use request.getParameter() its
servlet code problem - JSP-Servlet
servlet code problem  This is my JSP code index.jsp Sync Data Sync Data Please use the following input box to upload file or enter... to servlet im stuck with this error plzz help me..., thanks in advance....  
arraylist problem - JSP-Servlet
the first row. i m new to java. so i have messed up the code. but please... and POST methods. * @param request servlet request * @param response servlet response */ /* * To change this template, choose Tools

Ads