473,395 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

plz help in solving erroris showing invalid character used in sql query..so plz help

1
Expand|Select|Wrap|Line Numbers
  1. try
  2. {
  3. String url="jdbc:mysql://localhost/"+"userpwsd";
  4. Connection con=DriverManager.getConnection(url,"root","");
  5. Statement sn=con.createStatement();
  6. String s;
  7. s=SELECT 'username','password' FROM "userpwsd" WHERE username="+s1"' and password='"+s2+"'";
  8. out.println(s);
  9. ResultSet rs= sn.executeQuery("s=SELECT 'username','password' FROM 'userpwsd' WHERE username="+s1"' and password='"+s2"'";);
Jul 9 '14 #1
2 1315
rajujrk
107 100+
Hi

Try the below and let me know (UnTested)

Expand|Select|Wrap|Line Numbers
  1. try
  2.     {
  3.     String url="jdbc:mysql://localhost/userpwsd";
  4.     Connection con=DriverManager.getConnection(url,"root","");
  5.     Statement sn=con.createStatement();
  6.     String s;
  7.     s="SELECT username,password FROM userpwsd WHERE username='"+ s1 +"' and password='" + s2 + "'";
  8.     out.println(s);
  9.     ResultSet rs= sn.executeQuery(s);
  10.  
Thanks
Raju
Sep 19 '14 #2
chaarmann
785 Expert 512MB
Just repl. double quot. mrks w single around 2nd userpwsd.
Tx.

Check, "userpwsd" misspelled - reverse "ws" --> "userpswd".
Tx.
Sep 22 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Krung Saengpole | last post by:
Hi, I used SQL Server 2000 Personal Edition. I created a stored procedure having input parameters as smallint,tinyint,char,varchar and smalldatetime. When I executed it by Query Analyzer, it's...
3
by: D. Alvarado | last post by:
Hello, I am fairly new to xml. I wanted to indicate in my dtd that the element LINE_ITEM must contain one occurrence of the elements ISBN, QUANTITY, and TITLE, but in no particular order. ...
3
by: Todd | last post by:
Our ASP.NET (C#) application accepts form entry and saves inputed data in XML. We are finding that users are sometimes cutting and pasting special characters (from MS Word) into these forms....
2
by: SHC | last post by:
Hi all, I ran the attached volcanoes.xml (with geology.dtd) in the Module of Access 2003. I got the following error: Microsoft Office Access You have error Invalid Character in content model....
1
by: mariantrygg | last post by:
Set qdf = dbs.QueryDefs("qryUpdate_OMNIS_F_ST_Transactions") 'append qdf.Parameters(0) = DMax("STTR_SEQ", "CopyOMNIS_F_ST_Transaction") qdf.Execute dbSeeChanges This gives me an error 3146...
1
by: King Kong | last post by:
we are facing this kind of error when we double click the infragistic web grid please help me on this Regards Moid Iqbal Server Error in '/NetworkAccess' Application....
3
by: Arnold | last post by:
I am having problem loading the image from the database. It gives this error: "Invalid parameter used." This is my source code: Private abyt() As Byte Private fo As New OpenFileDialog Private sf...
3
by: Middletree | last post by:
Teaching myself ASP.NET, using Microsoft Press book called ASP.NET 2.0 by George Shepherd. Ch. 2, it says to type the following code: <%@ Page Language="C#" %> <html>
5
by: Joper | last post by:
Hi, I'm getting the ORA-00911:invalid character when trying to do a query to a Oracle database from a Excel VBA Macro. I'm using the following code extraction: ----BEGIN CODE----- Sub...
1
by: =?Utf-8?B?UGF1bCBQaGlsbGlwcw==?= | last post by:
I have read many things about this but I haven't got a clear vision on what to do if anything about this. I have a system that tries to find holes in my web site. One of the things it has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.