Solved

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

Posted on 2015-01-20
9
135 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 11

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 45

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 45

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 45

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 45

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

757 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

23 Experts available now in Live!

Get 1:1 Help Now