473,320 Members | 1,896 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,320 software developers and data experts.

cannot connect to mysql with jsp??

11
I dont know I should post JSP error in here or not. If not please redirect me to another one. Thx.

I just installed apache tomcat with mysql with java, but i got error when try to connect to mysql database, what is happening? Here is my error msg:

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 3 in the jsp file: /tutorial/test.jsp
Syntax error on tokens, delete these tokens
Expand|Select|Wrap|Line Numbers
  1. <%@ page import="java.sql.*" %>
  2. <%
  3. String connectionURL = "jdbc:mysql://localhost:3306/test?username="admin1"&password="admin"";
  4. Connection connection = null;
  5. Statement statement = null;
  6. ResultSet rs = null;
  7.  

Stacktrace:
Expand|Select|Wrap|Line Numbers
  1. org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandler.java:85)
  2. org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:330)
  3. org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:415)
  4. org.apache.jasper.compiler.Compiler.compile(Compil er.java:308)
  5. org.apache.jasper.compiler.Compiler.compile(Compil er.java:286)
  6. org.apache.jasper.compiler.Compiler.compile(Compil er.java:273)
  7. org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:566)
  8. org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:308)
  9. org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:320)
  10. org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:266)
  11. javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
  12.  
May 6 '08 #1
2 1966
Atli
5,058 Expert 4TB
Hi.

Your problem is most likely in the connection string, where you put double quotes inside a double-quoted string.

Try escaping the quotes inside the string using the \ char.
Like:
Expand|Select|Wrap|Line Numbers
  1. // Instead of doing
  2. String myString = "user="username"etc..";
  3.  
  4. // Try this
  5. String myString = "user=\"username\"etc..";
  6.  
And btw, I moved the thread over to the Java forums. ;)
May 6 '08 #2
r035198x
13,262 8TB
Use the + operator to concatenate two Strings.
May 6 '08 #3

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

Similar topics

2
by: Krista | last post by:
Hi, I hope you guys can help me out~~~ when I run it localhost/config.php, it cannot display any message such as connect successfully or failed. Do u guys have any idea? config.php <html>...
4
by: bettina | last post by:
Hello, My domain: www.coaster.ch My database: coasters User: bettina In the programm I wrote: <?php $db_server = "www.coaster.ch";
6
by: Jeff Sandler | last post by:
I have a database I created in mySQL. I've been entering data every day into the database using a Java application that I wrote. The database and the Java program are on the same Win 98 SE...
0
by: ryanmhuc | last post by:
I have root access to this server which has been preconfigured. I can connect using the mysql command tool. But I cannot connect using any mysql GUI software (I am currently tunneling the 3306 port...
5
by: smatta | last post by:
I have just installed MySql version 5.0-18 on Red Hat Fedora Core 4. It is running but I cant connect to it using MySql Query Browser running on my pc. >From my pc, I can telnet to the sql...
2
by: zMisc | last post by:
I am using VB.NET 1.1 and cannot connect to a MySQL (v5) database. I've done the following: 1) Create a DSN for MyODBC. 2) Connect using: Driver=MySQL ODBC 3.51 Driver; Server=localhost; Data...
1
by: marknewbery | last post by:
Hi, I have been trying to get a php, mySQL install to work and talk together on Windows XP SP2 with IIS. So far I installed and received a responce from php(V5 - manual install) though the ...
5
by: php-newbe | last post by:
I can conntect to mySQL thouth the mySQL monitor, but I cannot access it thorugh php script. After PHP5 installation I had uncommented "extention_php_mysql.dll" in php.ini file. I copied...
1
by: shmarafat | last post by:
Is There anyone who can help about this,Please ?
3
by: FNA access | last post by:
Hello all, I am relitivley new to mySQL. I started by downloading from the mySQL site. I then downloaded mySQL administrator and mySQL Query browser. With my set up I got a user root with a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.