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

  • SEARCH
  • Home
  • 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 8303743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:36:53+00:00 2026-06-08T17:36:53+00:00

Ok here’s my doubt… I have a blazeDS (tomcat) application with some classes, each

  • 0

Ok here’s my doubt…

I have a blazeDS (tomcat) application with some classes, each Class use the Config and DB Class for configuration and DB connection…

Here’s an example of

ConfigClass

public class Config {
    public static final String DBClass = "oracle.jdbc.driver.OracleDriver";
    public static final String ConnectString = "jdbc:oracle:thin:@//127.0.0.1:1521/xe";
    public static final String UserDB = "user";
    public static final String PasswordDB = "pass"; 
}

DB Class

public class DB
{       
    public DB() {}

    public static Connection dbConnect(Connection c)
    {
                try
                {      if (c == null || c.isClosed()){                                  
                            Class.forName(Config.DBClass);
                            c = DriverManager.getConnection(Config.ConnectString,Config.UserDB,Config.PasswordDB);
                        }
                return c;                        
                }
                catch (Exception e)
                {
                        System.out.println(e.getMessage());
                        return null;
                }
    }

    public static void closeConnection(Connection connection) throws SQLException
    {
        if (!connection.isClosed())
            connection.close();
    }
}

I have a test and production environment, with different user/password per DB access..
I noticed that when updating the production file with the test classes (I do not overwrite the Config.class), I got error from DB…

So, are the static final values (user/pass) in compiled version saved directly in the class itself (in my case DB.class)???

  • 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-08T17:36:54+00:00Added an answer on June 8, 2026 at 5:36 pm

    In short, yes.

    An excerpt from the Java specs:

    “References
    to fields that are constant variables (§4.12.4) are resolved at
    compile-time to the constant value that is denoted. No reference to
    such a field should be present in the code in a binary file (except in
    the class or interface containing the field, which will have code to
    initialize it). Such a field must always appear to have been
    initialized (§12.4.2); the default initial value for the type of such
    a field must never be observed. See §13.4.9 for a discussion.” (p.
    339)

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

Sidebar

Related Questions

Here is a scenario: User installs .NET application that you have made. After some
Here's some sample HTML <style> .icon {display:none;} </style> <ul> <li>ABC <i id=abc class=icon>x</i></li> <li>DEF
Here is the two scripts I have Script 1: <? include('config.php'); $json = $_POST['payload'];
Here is what I want to do. Use this HTML line and have the
Here's my situation. I have a DotNetNuke application. I want to link to an
Here is the code I have. This is my PrintToFile class import java.util.*; import
Here is what I have in my rack app #rb file require 'pry' class
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
I have just tried to save a simple *.rtf file with some websites and

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.