Solved

default instance vs. named instance in MSSQL 2008 "EXPRESS"

Posted on 2015-01-20
9
140 Views
Last Modified: 2015-01-26
Hi;

I needed to install the EXPRESS version of MSSQL 2008 and this version dictates to get installed with a named instance, but i need to have it as default instance. (and I couldn't)

Now the root of the case is that I have  the following ROOT.xml of Catalina tomcat and I couldn't set it up to run the named instance db.

<?xml version='1.0' encoding='utf-8'?>
<Context useNaming="true">
    <!--
    Replace the username, password and url parameters.
    In the URL the name after the last slash is the database name.
    The database must have been created, but be otherwise empty.
    -->
    <Resource name="jdbc/Test" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost:1433/JAZZ" maxActive="8" maxIdle="4" />

    <!-- This is needed to use SQLServer -->
    <Environment name="hibernateDialect" value="org.hibernate.dialect.SQLServerDialect" type="java.lang.String" override="false" />
</Context>

Open in new window


Essentially when i changed the localhost to my named instance, it's not working. It is working as above but I need to have it working with SQLEXPRESS.

Any help?

Regards.
0
Comment
Question by:jazzIIIlove
  • 4
  • 4
9 Comments
 
LVL 12

Expert Comment

by:Nakul Vachhrajani
ID: 40560538
The following immediately comes to mind:
1. Create an alias in the SQL Server Configuration Manager so that clients can use the alias name when connecting to your named instance
2. Connect using an IP address and port (Reference post here)
0
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40561665
By the connection string it's trying to connect to port 1433. Verify using SQL Server Configuration Manager if TCP/IP is enabled and which port is configured for the SQL Server instance.

 <Resource name="jdbc/Test" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost:1433/JAZZ" maxActive="8" maxIdle="4" />
0
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40561669
Alternative is to use the InstanceName property:

 <Resource name="jdbc/Test" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost;instanceName=SQLEXPRESS" maxActive="8" maxIdle="4" />

By the way, what's JAZZ? Was in the connection string after the port number.
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 40562008
JAZZ is the database name.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40562017
Then you should add the correct parameter:
<Resource name="jdbc/Test" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost:1433;databaseName=JAZZ" maxActive="8" maxIdle="4" />

Or with instance name:
<Resource name="jdbc/Test" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost;instanceName=SQLEXPRESS;databaseName=JAZZ" maxActive="8" maxIdle="4" />
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 40562108
with instance name:
<Resource name="jdbc/Test" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost;instanceName=SQLEXPRESS;databaseName=JAZZ" maxActive="8" maxIdle="4" />

I had the following exception:

2015-01-21 16:25:38,246 ERROR - Cannot create PoolableConnectionFactory (Network error IOException: Connection refused: connect)
2015-01-21 16:25:38,248 WARN  - Could not obtain connection metadata
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network error IOException: Connection refused: connect)
 at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
 at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
 at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
 at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
 at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
 at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
 at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
 at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)

Open in new window

0
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40562112
You are running it from the same machine where is SQL Server or it's from a remote server?
0
 
LVL 12

Accepted Solution

by:
jazzIIIlove earned 0 total points
ID: 40562840
Hi;

It just work with this

<Resource name="jdbc/Test" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost/JAZZ;instance=SQLEXPRESS" maxActive="8" maxIdle="4" />

Open in new window


together with enabling SQLServer Browser service.
0
 
LVL 12

Author Closing Comment

by:jazzIIIlove
ID: 40570206
it is a niche question and my solution works fine.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now