Solved

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

Posted on 2015-01-20
9
148 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
[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
  • 4
  • 4
9 Comments
 
LVL 13

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 50

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 50

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
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 12

Author Comment

by:jazzIIIlove
ID: 40562008
JAZZ is the database name.
0
 
LVL 50

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 50

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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 documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

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