Solved

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

Posted on 2015-01-20
9
142 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 47

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 47

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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 12

Author Comment

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

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 47

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server Count where two id types exist in column 8 27
convert null in sql server 12 32
SQL View nearest date 5 35
Sql Query 6 64
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

776 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