Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7188699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:08:33+00:00 2026-05-28T19:08:33+00:00

OK i am unable to connect my JSP program with MYSQL table to create

  • 0

OK i am unable to connect my JSP program with MYSQL table to create , retrieve or do anything with program

Using NetBeans 6.8, win XP sp 2, TOMCAT 6, etc…

In NetBeans showing tables connected, already applied MYSQL connector in C:\apache-tomcat-5.5.33\apache-tomcat-5.5.33\common\lib\mysql-connector-java-5.1.18-bin.jar

Code I am using to connect is

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
</head>
<body>
    <h1>Creating Table in DB using JSP</h1>


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<html>
    <head>
        <title>display data from the table using jsp</title>
    </head>
    <body>
        <%
                    /* Create string of connection url within specified
                    format with machine name, port number
                    and database name. Here machine name id localhost
                    and database name is usermaster. */
                    String connectionURL = "jdbc:mysql://localhost:3306/ipsj";
                    // declare a connection by using Connection interface
                    Connection connection = null;
                    // declare object of Statement interface that is used for
                    // executing sql statements.
                    Statement statement = null;
                    try {
                        // Load JBBC driver "com.mysql.jdbc.Driver".
                        Class.forName("com.mysql.jdbc.Driver").newInstance();
                        /* Create a connection by using getConnection() method
                        that takes parameters of string type connection url, user
                        name and password to connect to database. */
                        connection = DriverManager.getConnection(connectionURL, "root", "");

                        /* createStatement() is used for create statement object
                        that is used for sending
                        sql statements to the specified database. */
                        statement = connection.createStatement();
                        // sql query to retrieve values from the secified table.
                        String QueryString = "create table user_master(id int not null auto_increment,name " + "varchar(25),city varchar(20), primary key(id));";
                        // execyteUpdate() mothod execute specified sql query.
                        statement.executeUpdate(QueryString);
                        out.print("QueryString");
        %>
        <TABLE>
            <TR>
                <TD align="center" >
                    <font size="+3" color="green">Congratulations !</font>
                </TD>
            </TR>
            <tr>
                <TD align="center" >
                    <font size="+2">Table of specified name is created successfully.</font>
                </TD>
            </tr>

        <%      } catch (Exception ex) {%>
        </TABLE>
        <TABLE>
            <TR>
                <TD align="center" >
                    <font size="+3" color="red">Some problems to create table.</font>
                </TD>
            </TR>
            <%
            }

            %>
            <tr>
                <td align="center" >
                    <A HREF="welcome_to_database_query.jsp">
                        <font size="5" color="blue">back to home page</font>
                    </A>
                </td>
            </tr>
        </TABLE>
</body>

I don’t know whats wrong but it fails to connect. What I have already done:

  • installed MYSQL server,
  • restarted TOMCAT,
  • done administrative Tools connect thing.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:08:34+00:00Added an answer on May 28, 2026 at 7:08 pm

    Ok Here the Solution to connect MYSQL with JSP above given program. I asked about to my boss, he is a real expert…

    First open Netbeans

    Click on SERVICES
    then Right Click on the server like for me its “Apache Tomcat” then select Edit Server.XML

    Add below Line at line 39 i think between GlobalNamingResources tags

    <Resource name="jdbc/DATABASENAME" type="javax.sql.DataSource" maxActive="4" maxIdle="2" username="root" password="" maxWait="23000" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/DATABASENAME"></Resource>
    

    and Save it

    Now select Projects

    then right Click on the project you are working and select Properties

    Now in Libraries Under Compile tab click Add JAR
    Then locate your “mysql-connector-java-5.1.18-bin.jar”

    then click ok

    then restart server

    then Its Done !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Netbeans 6.8 to develop application using JSP. I'm able to work with
We are unable to connect to an HTTPS server using WebRequest because of this
Unable to connect to your database server using the provided settings. I've been having
Getting unable to connect error on calling my second subroutine. I'm using 2 sub
After some virus activity I'm unable to connect to a MySQL db on my
Problem : I am unable to connect to a TLS enabled webservice endpoint using
I am using TATA PHOTON PLUS. Android Emulator browser is unable to connect to
i am unable to connect to visual studio remote debugger when it is running
I am unable to create an empty solution in Visual Studio. The msdn documentation
I'm unable to connect to the local SQL Server with connectionString="data source=.;Initial Catalog=TestDB;Integrated Security

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.