Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

jdbc:sqlserver driver  "Request Attention"

Posted on 2012-04-05
3
Medium Priority
?
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article discusses how to create an extensible mechanism for linked drop downs.
This video teaches viewers about errors in exception handling.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

688 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