Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

jdbc:sqlserver driver  "Request Attention"

Posted on 2012-04-05
3
Medium Priority
?
279 Views
Last Modified: 2012-04-09
hello:
I am trying to map a SQL server 2008r2:
and this is the convention I found on the net:

jdbc:sqlserver://server:port;DatabaseName=dbname

so I fill in:

jdbc:sqlserver://MyMachine\SQL Instance name:1433; XYZ=?????

The question is this:
DatabaseName=dbname - are not those the same (why would I put dbabasename=dbname)?

Is placing the IP of the machine better than  placing MyMachine\SQL Instance name ?


Thank you.
0
Comment
Question by:noamco36
  • 2
3 Comments
 
LVL 28

Assisted Solution

by:Ryan McCauley
Ryan McCauley earned 2000 total points
ID: 37815236
If you're connecting to the default instance (on port 1433), and it appears that you are, I suspect you can omit the "SQL Instance Name:1433" segment of your connection string. You'll probably just need something like:

jdbc:sqlserver://MyMachine;DatabaseName=SomeDbOnYourServerThatYoureAccessing

Open in new window


The "DatabaseName" identifier is literal - what you'll want to change is the value after it, which tells the JDBC driver which database you'll be accessing. You can always switch database context after you connect, or access data from another database you have rights to, but it just tells you where you're starting.

I'd actually favor using the server's DNS name ("MyMachine" above) instead of the IP address - it makes it easier if you have to change the IP address of the server later.
0
 

Author Comment

by:noamco36
ID: 37815306
so do you mean it should be like this?

jdbc:sqlserver://MyMachine;XYZdb
 
or mayby:

jdbc:sqlserver://Chats101;AdventureWorks

or maybe:

jdbc:sqlserver://192.168.1.64;AdventureWorks


are any of those wrong?
0
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 2000 total points
ID: 37816221
Do any of those work?

I've not used jdbc to connect before, but I'd expect it to be like this (for clarify, only the italic text should be edited by you - everything else should stay the same):

jdbc:sqlserver://MyMachine;DatabaseName=AdventureWorks

The "DatabaseName" identified should be in your string, and you provide the database name to the right of the = sign, so you'll only change the IP (if needed) and replace "AdventureWorks" with the name of your database.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question