Results 1 to 6 of 6
  1. #1
    an24 is offline Member
    Join Date
    Nov 2009
    Location
    Russia
    Posts
    9
    Rep Power
    0

    Default A question on JDBC&SQL Server

    I have created a JBDC-connection via getConnection(url, user, password).
    But there can be a situation, that a computer, where my application will be deployed, does not contain such user.

    Is there an effective and generic way to deal with this problem?

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    Can you please provide more info about your application nature.

    Standalone or web app?

    Are DB and main app on same PC/server?

    Do users need to register or admin creates users credentials?

    Usernames and password can be in DB, properties file, security discs...
    so get us better look in what you actually need

  3. #3
    an24 is offline Member
    Join Date
    Nov 2009
    Location
    Russia
    Posts
    9
    Rep Power
    0

    Default

    My application uses JSP and Servlet.
    I need to connect to the database to validate login-password:
    the client enters his login&password (via JSP), and the server validates the pair (via Servlet). The Servlet exploits a LoginChecker-class (I have written it), which connects to the database.
    Login-password pairs are stored at the SQL Server under some SQL Server-user.

  4. #4
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    From my point of view there is not such situation :)

    "Computer, where application will be deployed (), does not contain such user."


    Such user, for connection creation used in:
    Java Code:
     getConnection(url, user, password)
    is user probably created during DB installation and it is stored
    somewhere in DB system catalog.

    You take that url , username and pass and put in in your,
    let's say some db.properties file in src folder of your project:

    Java Code:
    databaseName = testdb
    host =171.19.48.122
    portNumber = 5432
    username = someuser
    password = somepass
    Now you have to deploy your application that contains db.properties file.

    It' does not metter if you put your app's *.war file
    on local web server or some other machine.

    Only thing that matters network configuration
    so that web server and DB server can work with no firewall and other problems.

    Does this make any sense for you :) ?

  5. #5
    an24 is offline Member
    Join Date
    Nov 2009
    Location
    Russia
    Posts
    9
    Rep Power
    0

    Default

    Yes, thank you.
    And one question about the solution you have suggested -

    What should be done if eventually some DB parameters (user, host, port, dbName) change?
    Then a deployer is assumed to correct db.properties at his computer?

  6. #6
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

Similar Threads

  1. Server and db Question
    By SamuelM in forum Forum Lobby
    Replies: 2
    Last Post: 12-30-2009, 06:58 PM
  2. Replies: 0
    Last Post: 12-01-2009, 10:01 PM
  3. JDBC statement question
    By nick2price in forum Advanced Java
    Replies: 21
    Last Post: 09-29-2008, 02:09 PM
  4. JSP Connecting to MS SQL SERVER 2000 using JDBC
    By hisouka in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 09-02-2008, 09:23 AM
  5. SQL Server 2005 Jdbc connection
    By mgt83 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-27-2007, 04:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •