Solved

jdbc:sqlserver driver  "Request Attention"

Posted on 2012-04-05
3
260 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 500 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 500 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.

773 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