Results 1 to 8 of 8
  1. #1
    moony is offline Member
    Join Date
    May 2012
    Posts
    23
    Rep Power
    0

    Default Java and SQL Server

    Hi all !
    Sorry for elementary question. I don't waste your time much. Please, explain me how is doing connection between SQL Server Database and java?
    I read more and watch tutorials about that, but I don't understand the principe of writing url address of database. For example, if I have database in my computer, with what address I can connect it?

    For example, this is url connection address

    url ="jdbc:sqlserver://localhost:1433"
    I don't understand this...

    Thanks in advance.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: Java and SQL Server

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Java and SQL Server

    Each JDBC driver has a different URL signature for connecting to a database.
    The one you have there is the standard jdbc:sqlserver one.
    That's what the first part says.
    If you were using the JTDS driver it would say jdbc:jtds:sqlserver.
    This allows JDBC to find the correct driver to use.

    The second half is just the location of the port on which the server is listening for connections.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    moony is offline Member
    Join Date
    May 2012
    Posts
    23
    Rep Power
    0

    Default Re: Java and SQL Server

    OK, thanks so much for your explanation !
    Please, tell me, can I be connected to Northwind pubs SQL examples? If yes, how is it possible?

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Java and SQL Server

    Have that on your SQL Server and then look up the URL you need (probably the one above).
    Google for SQL Server JDBC and read up on MSDN about what the options are on the connection string. There is one to specify which database instance you want to be connected to (in your case whatever the Northwinds db is called).
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    moony is offline Member
    Join Date
    May 2012
    Posts
    23
    Rep Power
    0

    Default Re: Java and SQL Server

    As I understood each database has its own url, which I can get above of window?

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Java and SQL Server

    The MSDN articles will explain what you need to do.
    I never bother remebering these things as I work on different DBs every few months, so I'd have to look it up.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    moony is offline Member
    Join Date
    May 2012
    Posts
    23
    Rep Power
    0

Similar Threads

  1. Replies: 6
    Last Post: 12-25-2011, 11:33 PM
  2. Java Server
    By Lightning in forum Networking
    Replies: 1
    Last Post: 12-30-2010, 11:16 PM
  3. java server
    By mayanksachan in forum Networking
    Replies: 1
    Last Post: 09-19-2010, 05:39 PM
  4. Java , Java script , Java server pages
    By DoNot in forum New To Java
    Replies: 5
    Last Post: 06-15-2010, 09:44 AM
  5. Add Java Server Face Fragment in JSP with JAVA
    By fabio.beoni in forum New To Java
    Replies: 0
    Last Post: 02-05-2009, 12:14 PM

Tags for this Thread

Posting Permissions

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