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 8045535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:34:42+00:00 2026-06-05T05:34:42+00:00

When I try and connect it my mysql database with JDBC in java, it

  • 0

When I try and connect it my mysql database with JDBC in java, it doesn’t go to my web server.

Here is the code

String dbtime;
String dbUrl = "jdbc:mysql://184.172.176.18:3306/dcsoft_dcsoft_balloon";
String dbUser = "myuser";
String dcPass = "mypass";
String dbClass = "com.mysql.jdbc.Driver";
String query = "Select * FROM users";

try {

    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection(dbUrl, dbUser, dcPass);
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery(query);

    while (rs.next()) {
        dbtime = rs.getString(1);
        System.out.println(dbtime);
    } 

    con.close();

} catch(ClassNotFoundException e) {
    e.printStackTrace();
} catch(SQLException e) {
    e.printStackTrace();
}

This code is supposed to go to my web server but it gives this error
java.sql.SQLException: Access denied for user ‘dcsoft_dcsoft_java’@’jamesposse.force9.co.uk’ (using password: YES)

jamesposse.force9.co.uk is the not the address im trying to connect to I’m trying to connect to 184.172.176.18:3306.

Thanks.


The hosts file contents is –

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#   ::1             localhost

and lmhosts is –

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample LMHOSTS file used by the Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to computernames
# (NetBIOS) names.  Each entry should be kept on an individual line.
# The IP address should be placed in the first column followed by the
# corresponding computername. The address and the computername
# should be separated by at least one space or tab. The "#" character
# is generally used to denote the start of a comment (see the exceptions
# below).
#
# This file is compatible with Microsoft LAN Manager 2.x TCP/IP lmhosts
# files and offers the following extensions:
#
#      #PRE
#      #DOM:<domain>
#      #INCLUDE <filename>
#      #BEGIN_ALTERNATE
#      #END_ALTERNATE
#      \0xnn (non-printing character support)
#
# Following any entry in the file with the characters "#PRE" will cause
# the entry to be preloaded into the name cache. By default, entries are
# not preloaded, but are parsed only after dynamic name resolution fails.
#
# Following an entry with the "#DOM:<domain>" tag will associate the
# entry with the domain specified by <domain>. This affects how the
# browser and logon services behave in TCP/IP environments. To preload
# the host name associated with #DOM entry, it is necessary to also add a
# #PRE to the line. The <domain> is always preloaded although it will not
# be shown when the name cache is viewed.
#
# Specifying "#INCLUDE <filename>" will force the RFC NetBIOS (NBT)
# software to seek the specified <filename> and parse it as if it were
# local. <filename> is generally a UNC-based name, allowing a
# centralized lmhosts file to be maintained on a server.
# It is ALWAYS necessary to provide a mapping for the IP address of the
# server prior to the #INCLUDE. This mapping must use the #PRE directive.
# In addtion the share "public" in the example below must be in the
# LanManServer list of "NullSessionShares" in order for client machines to
# be able to read the lmhosts file successfully. This key is under
# \machine\system\currentcontrolset\services\lanmanserver\parameters\nullsessionshares
# in the registry. Simply add "public" to the list found there.
#
# The #BEGIN_ and #END_ALTERNATE keywords allow multiple #INCLUDE
# statements to be grouped together. Any single successful include
# will cause the group to succeed.
#
# Finally, non-printing characters can be embedded in mappings by
# first surrounding the NetBIOS name in quotations, then using the
# \0xnn notation to specify a hex value for a non-printing character.
#
# The following example illustrates all of these extensions:
#
# 102.54.94.97     rhino         #PRE #DOM:networking  #net group's DC
# 102.54.94.102    "appname  \0x14"                    #special app server
# 102.54.94.123    popular            #PRE             #source server
# 102.54.94.117    localsrv           #PRE             #needed for the include
#
# #BEGIN_ALTERNATE
# #INCLUDE \\localsrv\public\lmhosts
# #INCLUDE \\rhino\public\lmhosts
# #END_ALTERNATE
#
# In the above example, the "appname" server contains a special
# character in its name, the "popular" and "localsrv" server names are
# preloaded, and the "rhino" server name is specified so it can be used
# to later #INCLUDE a centrally maintained lmhosts file if the "localsrv"
# system is unavailable.
#
# Note that the whole file is parsed including comments on each lookup,
# so keeping the number of comments to a minimum will improve performance.
# Therefore it is not advisable to simply add lmhosts file entries onto the
# end of this file.
  • 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-06-05T05:34:44+00:00Added an answer on June 5, 2026 at 5:34 am

    jamesposse.force9.co.uk is the machine that you’re connecting from.

    When MySQL complains Access denied for user 'dcsoft_dcsoft_java'@'jamesposse.force9.co.uk', it means that the user dcsoft_dcsof_java was not authorized to connect from the host jamesposse.force9.co.uk.

    In MySQL, you are authenticated by the username you try to connect to, and the hostname you’re trying to connect from. This is why you grant access to users like:

    grant access to 'dcsoft_dcsoft_java'@'localhost' identified by 'whatever'
    

    This user can only connect from the same machine as the MySQL server (e.g. from webapps hosted on the same machine, or when you SSH into the machine and use the mysql commandline from there).

    If you want to grant access to a specific machine, identify it by hostname or IP address.

    grant access to 'dcsoft_dcsoft_java'@'184.172.176.18' identified by 'whatever'
    

    To grant access from anywhere on the internet, use '%' as the host:

    grant access to 'dcsoft_dcsoft_java'@'%' identified by 'whatever'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do you connect to a MySQL database in Java? When I try, I
my code is this try { //Connect to the login server socket = new
Using Java, I get this error when attempting to connect to a mysql database:
I am trying to connect to MySQL database with Java and I get the
Here is a part from my program: try { Class.forName(com.mysql.jdbc.Driver); InitializeData data = new
can anyone help me how to connect my java forms to my mysql database?
I've created a web service to connect my android device to a mysql database.
Hello I try to connect F# and MySQL database, but i got fallowing error
I am trying to connect to mysql database. I am using try catch while
I am currently using this simple code to try to connect to my database

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.