473,385 Members | 2,013 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,385 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 1314
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.