java servlet connectivity problem with access


java servlet connectivity problem with access

java servlet connectivity problem with access
1 Answer(s)      5 years and 3 months ago
Posted in : Java Beginners
Import java.sql

//all packages entered
try {
           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

ERROR MSG on cmd incompatible types
found   : java.sql.Connection
required: Connection
           Connection con = DriverManager.getConnection("jdbc:odbc:CUSTOMER");
                                                       ^ 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
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
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 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
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
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
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: Thanks
**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
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 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
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:
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
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
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
Java connectivity with MySQL
Java connectivity with MySQL  Java connectivity with MySQL
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
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
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 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
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
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
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
servlet problem  wheni m deploying an servlet application im getting trouble context [/filename] startup failed due to previous error in tomcat 6.0.
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
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