java & mysql
I wrote the code as shown below, i am getting the error like
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"
my code is
<%
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/voting","root","");
PreparedStatement pst=con.prepareStatement("select * from election");
ResultSet rs=pst.executeQuery();
int i=1;
String pname="";%>
<h1 align="center">DELETE LEADER</h1>
<form action="deleteaction.jsp" method="get">
<table border="1">
<%
while(rs.next())
{
%>
<tr>
<td><%pname=rs.getString(1);%></td>
</tr>
<%
PreparedStatement pst1=con.prepareStatement("select * from "+pname+" ");
ResultSet rs1=pst1.executeQuery();
while(rs1.next())
{
%>
<tr>
<td><input type="checkbox" /></td>
<td><%=rs1.getString(3) %></td>
<td><%=rs1.getString(2) %></td>
</tr>
<%
}
}
%>
</table>
<% }catch(Exception e)
{
e.printStackTrace();
}finally
{
}
%>
its not assigning the string to "pname"?
can anyone plz help me.
View Answers
Ads
Related Tutorials/Questions & Answers:
Java and MySQL
Java and MySQL
I am doing a project on an accounting system. I need to know to things:
How do I write reports using information in an
MySQL database .
How get multiple
MySQL database rows and assign them to variables r
Java and Mysql
Java and Mysql Sir,
I want to connect my
java program with
mysql server (
mysql server is situated on another windows machine )
???
????
?????
Put
mysql jar file in your jdk lib and set the classpath. After
Advertisements
mysql-java
mysql-
java i try to execute this code
stmt1.executeUpdate("insert... the manual that corresponds to your
MySQL server version for the right syntax to use...)
at Mydb.main(Mydb.java:111)
Java Result: 1
please help me to find the error
 
java & mysql
java & mysql I wrote the code as shown below, i am getting the error... to your
MySQL server version for the right syntax to use near '' at line 1"
my...("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:
mysql
java & mysql
java & mysql I wrote the code as shown below, i am getting the error... to your
MySQL server version for the right syntax to use near '' at line 1"
my...("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:
mysql
java & mysql
java & mysql I wrote the code as shown below, i am getting the error... to your
MySQL server version for the right syntax to use near '' at line 1"
my...("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:
mysql
java & mysql
java & mysql I wrote the code as shown below, i am getting the error... to your
MySQL server version for the right syntax to use near '' at line 1"
my...("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:
mysql
java & mysql
java & mysql I wrote the code as shown below, i am getting the error... to your
MySQL server version for the right syntax to use near '' at line 1"
my...("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:
mysql
MySql,java
MySql,java In
MySQL table i am adding the fields of name,photo,video,age,category.in the category i have some subjects.if one person login into my-site the he upload the one video under one subject.then i want the following
MYSQL Java Connector Library
Where to download the
MYSQL Java Connector Library and get the jar file
This article discuss 'how to connect
Java and
MYSQL using
MYSQL connector' in
Java. The article will give you view on downloading and installing
MYSQL Java
Connecting to MYSQL Database in Java
Connecting to
MYSQL Database in Java I've tried executing the code...("
MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:
mysql://localhost/";
String dbName = "textbook";
String driver
JBBC ,MYSQL ND JAVA
JBBC ,
MYSQL ND JAVA import java.sql.*;
import...:
mysql://localhost/ACCOUNT","root","ADMIN");
st=con.createStatement...("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:
mysql://localhost:3306/test