473,770 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cannot connect to mysql with jsp??

11 New Member
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.jasp er.JasperExcept ion: 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 1996
Atli
5,058 Recognized Expert Expert
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 MVP
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
4253
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> <head><title>Create Database and table</title></head> <body> <?php
4
5361
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
4140
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 machine. I've been working on another program (an applet) to send and receive data over the internet. I got the applet to connect with the database and receive data. All the while I was developing the applet, I would tell it to find the database at...
0
2302
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 to 3306 on the server using SSH). So i ran mysqladmin variables. And got the following: port 0 instead of the usually port 3306. Obviously I cannot connect on port 0. How can I troubleshoot this and get mysql running so I can connect via
5
5093
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 server / port. I get back a garbled message: 5.0.18-standard§}WxyuadT,☻V6F?J5i1YMT= Should this be garbled ? or is there a problem ?
2
10504
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 Source=test; UID=test; PWD=pwd; OPTION=3 When I run my app, I get this error: An OLE DB Provider was not specified in
1
6114
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 <?php phpinfo(); ?> command which prints out the current settings of the php install. I then installed mySQL complete setup (V5) and ran the server instance
5
2347
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 libmysql.dll from MySQL installation file to php directory overriding the pre-installed file. I also Edit the PATH in the system path = ;c:/php I still cannot access mySQL!
1
2048
by: shmarafat | last post by:
Is There anyone who can help about this,Please ?
3
4911
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 specified password. I created a DB(school) . When I log into mySQL Query browser with root connection, I see all my tables etc. I even see the information_schema. I can select anything from anything. I set up a new user (student)that has...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.