users@glassfish.java.net

Re: Vista, Jee5, sql2000 &sql2005

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Mon, 02 Mar 2009 09:53:56 -0500

I don't think it is possible for a JDBC driver, GlassFish or Java to
have made Management Studio or SQL Server to stop working. I think it
is an unrelated problem.

Once you get it working again, examine the various JDBC driver
properties you can add to the datasource in GlassFish:

http://jtds.sourceforge.net/faq.html#driverImplementation

For example: instance, loginTimeout, portNumber

The connection pools you create in the glassfish admin console get saved
in domains\domain1\config\domain.xml. My dev computer's connection to
SQL Server 2005 looks like this:


    <jdbc-connection-pool allow-non-component-callers="false"
associate-with-thread="false" connection-creation-retry-attempts="0"
connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
connection-validation-method="auto-commit"
datasource-classname="net.sourceforge.jtds.jdbcx.JtdsDataSource"
fail-all-connections="true" idle-timeout-in-seconds="300"
is-connection-validation-required="true"
is-isolation-level-guaranteed="false"
lazy-connection-association="false" lazy-connection-enlistment="false"
match-connections="false" max-connection-usage-count="0"
max-pool-size="32" max-wait-time-in-millis="60000"
name="CentralDataPool" non-transactional-connections="false"
pool-resize-quantity="2" res-type="javax.sql.ConnectionPoolDataSource"
statement-timeout-in-seconds="-1" steady-pool-size="8"
validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
      <description>a description of this connection pool</description>
      <property name="instance" value="sql2005"/>
      <property name="user" value="myusername"/>
      <property name="password" value="secret"/>
      <property name="databaseName" value="MyGreatDB"/>
      <property name="loginTimeout" value="45"/>
      <property name="serverName" value="someHostName"/>
    </jdbc-connection-pool>




Eve Pokua wrote:
> Sorry,
>
> This is what i get when I try to log into the management studio:
>
> TITLE: Connect to Server
> ------------------------------
> Cannot connect to EDELLVE\SQLEXPRESS.
> ------------------------------
> ADDITIONAL INFORMATION:
> A network-related or instance-specific error occurred while
> establishing a connection to SQL Server. The server was not
> found or was not accessible. Verify that the instance name
> is correct and that SQL Server is configured to allow remote c
> onnections. (provider: Shared Memory Provider, error: 40 -
> Could not open a connection to SQL Server) (Microsoft SQL Server,
> Error: 2)
> For help, click:
> http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc
> <http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc>=
> MSSQLServer&EvtID=2&LinkId=20476
> ------------------------------
> BUTTONS:
> OK
>
> ------------------------------------------------------------------------
> From: gorgeous65_at_msn.com
> To: users_at_glassfish.dev.java.net
> Date: Mon, 2 Mar 2009 14:16:12 +0000
> Subject: RE: Vista, Jee5, sql2000 &sql2005
>
> Hello Ryan, Martin,
>
> Everyone,
>
> When I create it like what Martin suggested, when I restart the
> application server,
> it gets rid of the directory. I then created it like what
> Ryan suggested, it works but
> I have a different type of problem.
>
> I can't seem to be able to connect to my MS SQL Express even though
> before I could.
> I can't seem to start the service even though before it
> started automatically and it setting
> of automatically is set on the service. Something must be wrong. On
> top of that it says in
> the admin console when I ping- error. Server log -
>
> Caused by: java.sql.SQLException: Unknown server host name
> 'EDELLVE\SQLEXPRESS'.
> at
> net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:377)
> at
> net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
> at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
> at
> net.sourceforge.jtds.jdbcx.JtdsDataSource.getConnection(JtdsDataSource.java:186)
> at
> net.sourceforge.jtds.jdbcx.JtdsDataSource.getPooledConnection(JtdsDataSource.java:264)
> at
> net.sourceforge.jtds.jdbcx.JtdsDataSource.getPooledConnection(JtdsDataSource.java:250)
> at
> com.sun.gjc.spi.CPManagedConnectionFactory.createManagedConnection(CPManagedConnectionFactory.java:126)
> ... 75 more
> Caused by: java.net.UnknownHostException: EDELLVE\SQLEXPRESS
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
> |#]
> [#|2009-03-02T14:04:45.315+0000|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=14;_ThreadName=httpWorkerThread-4848-0;_RequestID=6445f8cc-0f01-40b4-b059-e8716d72fd6c;| at
> java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> com.sun.enterprise.server.ss.provider.ASPlainSocketImpl$2.run(ASPlainSocketImpl.java:419)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> com.sun.enterprise.server.ss.provider.ASPlainSocketImpl._invoke(ASPlainSocketImpl.java:416)
> at
> com.sun.enterprise.server.ss.provider.ASPlainSocketImpl.connect(ASPlainSocketImpl.java:288)
> at
> com.sun.enterprise.server.ss.provider.ASClientSocketImpl.connect(ASClientSocketImpl.java:267)
> at java.net.Socket.connect(Socket.java:519)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:304)
> at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:255)
> at
> net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:310)
> ... 81 more
> |#]
>
>
> Basically, the server host name is wrong, even though I copied the
> exact name from management
> studio express. And can't log into the Management studio express with
> either SQL Autherication
> or windows; or start the service. But it used to work before that's
> why I was able to create a database
> in it.
>
> Thanks
>
> eve
>
> > Date: Sun, 1 Mar 2009 22:36:34 -0500
> > From: ryan_at_ijws.com
> > To: users_at_glassfish.dev.java.net
> > Subject: Re: Vista, Jee5, sql2000 &sql2005
> >
> > I've always put JDBC driver .jar files in domains\domain1\lib\ or
> > domains\domain1\lib\ext\
> >
> > Next create a JDBC Connection Pool and JNDI reference in GlassFish's
> web
> > admin console.
> >
> > I'm not familiar with what Martin Gainty described below (JBI)
> >
> >
> > Martin Gainty wrote:
> > > configure the component thru the admin interface e.g.
> > > http://localhost:4848/
> > >
> > > library should be located in
> > >
> %GLASSFISH_HOME%\domains\domain1\jbi\shared-libraries\jtds\install_root\jtds-1.2.2.jar
> > >
> > > place jbi.xml configuration
> > >
> > >
> %GLASSFISH_HOME%\domains\domain1\jbi\shared-libraries\jtds\install_root\META-INF\jbi.xml
> > >
> > > <?xml version="1.0"?>
> > > <!-- jbi.xml file for a sample shared library. -->
> > > <jbi
> > > version="1.0"
> > > xmlns="http://java.sun.com/xml/ns/jbi"
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > >
> > > <!-- identification information about this shared library-->
> > > <shared-library>
> > > <identification>
> > > <name>jtds</name>
> > > <description>blah..blah..blah..</description>
> > > </identification>
> > > <shared-library-class-path>
> > > <path-element>jtds-1.2.2.jar</path-element>
> > > </shared-library-class-path>
> > > </shared-library>
> > > </jbi>
> > >
> > > HTH
> > > Martin
> > > ______________________________________________
> > > Disclaimer and confidentiality note
> > > Everything in this e-mail and any attachments relates to the official
> > > business of Sender. This transmission is of a confidential nature and
> > > Sender does not endorse distribution to any party other than intended
> > > recipient. Sender does not necessarily endorse content contained
> > > within this transmission.
> > >
> > >
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > From: gorgeous65_at_msn.com
> > > To: users_at_glassfish.dev.java.net
> > > Date: Mon, 2 Mar 2009 00:30:22 +0000
> > > Subject: RE: Vista, Jee5, sql2000 &sql2005
> > >
> > > Hello,
> > >
> > > I have finally got round to download this JTDS driver -
> > >
> > >
> http://sourceforge.net/project/showfiles.php?group_id=33291&package_id=25350&release_id=534076#
> > >
> > > unzip it
> > >
> > > and copied the jar file -
> > >
> > > jtds-1.2.2
> > >
> > > into a directory i created -
> > >
> > > c:\ClassPath\JTDS\jtds-1.2.2
> > >
> > > SETUP MY Environmental variables as-
> > >
> > > CLASSPATH=C:\CLassPath\JTDS\jtds-1.2.2.
> > >
> > >
> > > Also added it to my Application Server\JVM seetings\path settings
> > >
> > > under
> > >
> > > Classpath Prefix =C:\CLassPath\JTDS\jtds-1.2.2
> > >
> > > I get the error -
> > >
> > > Class name is wrong or classpath is not set for :
> > > net.sourceforge.jtds.jdbcx.JtdsDataSource
> > >
> > >
> > > I hope I am on the right track. Any ideas? its my first time
> > > of using this driver.
> > >
> > > thanks.
> > >
> > > eve
> > >
> > >
> > > > Date: Wed, 4 Feb 2009 15:55:58 -0500
> > > > From: ryan_at_ijws.com
> > > > To: users_at_glassfish.dev.java.net
> > > > Subject: Re: FW: Vista, Jee5, sql2000 &sql2005
> > > >
> > > > The .jar does not come with GlassFish, you have to download it
> manually.
> > > >
> > > > I do not recommend using Microsoft's JDBC driver. When we use it in
> > > > production to communicate with a remote SQL Server 2005 EE, at least
> > > > once per week there is a problem trying to connect to the
> database. The
> > > > Microsoft driver blocks the thread that is asking for a connection
> > > > indefinitely. Looking at the FINE/FINER logs, it shows "TDS prelogin
> > > > response error". Once this happens 5 times then the HTTP
> Listener for
> > > > your web application can no longer respond to web requests and
> it looks
> > > > like GlassFish is locked up. This happens even when you set the
> > > > loginTimeout property. We tested the latest 1.2 version of the
> driver.
> > > >
> > > > We use the open source jTDS driver instead. It doesn't have this
> > > > problem and works well.
> > > >
> > > >
> > > > Ryan
> > > >
> > > >
> > > >
> > > >
> > > > Marina Vatkina wrote:
> > > > > Did you try to search Microsoft site?
> > > > >
> > > > > thanks,
> > > > > -marina
> > > > >
> > > > > Dr. Charles O. Odeyale wrote:
> > > > >> No, it is not in either location; not even on my system for that
> > > > >> matter. I have gone to Sun.com to look for it but came back
> empty. I
> > > > >> will continue to look to download a copy and report back. Is
> there
> > > > >> anything else I may need, or need to do?
> > > > >>
> > > > >> Thanks.
> > > > >>
> > > > >> ----- Original Message ----- From: <glassfish_at_javadesktop.org>
> > > > >> To: <users_at_glassfish.dev.java.net>
> > > > >> Sent: Wednesday, February 04, 2009 1:21 AM
> > > > >> Subject: Re: FW: Vista, Jee5, sql2000 &sql2005
> > > > >>
> > > > >>
> > > > >>> Is the sqljdbc.jar copied in the <install_root>/lib or
> > > > >>> <install_root>/domains/domain1/lib/ext directories? The jar
> should
> > > > >>> be made available to the application server in order to load the
> > > > >>> class : com.microsoft.sqlserver.jdbc.SQLServerDataSource.
> > > > >>> [Message sent by forum member 'sm157516' (sm157516)]
> > > > >>>
> > > > >>> http://forums.java.net/jive/thread.jspa?messageID=330006
> > > > >>>
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > > > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> > > >
> > >
> > >
> ------------------------------------------------------------------------
> > > Beyond Hotmail — see what else you can do with Windows Live. Find out
> > > more!
> > >
> ------------------------------------------------------------------------
> > > Windows Live™: Life without walls. Check it out.
> > >
> <http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> >
>
> ------------------------------------------------------------------------
> Windows Live Messenger just got better. Find out more!
> <http://clk.atdmt.com/UKM/go/134665230/direct/01/>
> ------------------------------------------------------------------------
> Windows Live Hotmail just got better. Find out more!
> <http://clk.atdmt.com/UKM/go/134665311/direct/01/>