-1

I'm trying to connect my SQLSERVER 2008 (localhost)database with java.

I m using net.sourceforge.jtds.jdbc.Driver and I have all connection properities without IP address and portnumber.

class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
    <property name="url" value="jdbc:jtds:sqlserver://127.0.0.1:1098/userdb" />
    <property name="username" value="root" />
    <property name="password" value="root" />
Yellow Flash
  • 862
  • 2
  • 10
  • 29
  • SO is the wrong site for questions like this; you may want to try http://serverfault.com/ instead. – Adrian Wragg Sep 12 '13 at 10:25
  • 4
    Not really a question for serverfault - this is very definitely a question that ought to be handled internally - you really don't want a coder who has no idea how to access his database. Internal documentation should handle this. Please do not punt this over to SF or SU. – Journeyman Geek Sep 16 '13 at 07:08
  • 1
    The answer from ServerFault will be "ask the system administrator". – Andrew Sep 16 '13 at 07:09

1 Answers1

3

localhost is your ip number 127.0.0.1

and default port should be 1433

Normally the connection string is like:

jdbc:sqlserver://localhost:1433;DatabaseName=XXX;user=AAA;Password=BBB

See links that might show you the different steps:

Help me create a jTDS connection string

http://forums.devshed.com/ms-sql-development-95/jdbc-and-sql-server-2008t-579217.html

http://thusithamabotuwana.wordpress.com/2012/01/08/connecting-to-sql-server-using-jtds/

Community
  • 1
  • 1
MrSimpleMind
  • 7,890
  • 3
  • 40
  • 45