I am trying to setup a datasource using the Microsoft SQL Server 2000 JDBC
driver, and as far as i can tell, there are no classes that i can
instantiate - only abstact interfaces. has anyone successfully setup a
datasource on 4.x with these drivers? i don't know much about any of this,
and any example code would be great. thanks in advance, 

Jimmy

-----Original Message-----
From: Micael Padraig Og mac Grene [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 14, 2001 2:26 PM
To: Tomcat Users List
Subject: Re: JNDI DataSource Question


At 07:07 PM 12/14/01 +0000, you wrote:
>Hi,
>
>Thankyou for the mail.
>
>my datasource is sitting on the local computer and I can connect with a 
>normal JDBC Connection. The same driver properties I use to create a 
>datasource in server.xml and it fails.
>
>I thought it can be a problem like Tomcat failing if we have the 
>servlet.jar in <java>/lib/ext, so I cleaned it out.
>
>Any pointers?
>
>Krishna.
>
>


You did not really provide any information that I do not have to guess 
at.  Where are the files?  What does server.xml say?  What do you have in 
web.xml?  I use, in relevant part, for example:

<web-app>
         .......
          <servlet>
                  <servlet-name>setup</servlet-name>
                  <servlet-class>SetupServlet</servlet-class>
                  <init-param>
                          <param-name>jdbcDriver</param-name>
                          <param-value>org.postgresql.Driver</param-value>
                  </init-param>

                  <init-param>
                          <param-name>jdbcURL</param-name>
 
<param-value>jdbc:postgresql://localhost:5432/username/param-value>
                  </init-param>

                  <init-param>
                          <param-name>jdbcUser</param-name>
                          <param-value>username</param-value>
                  </init-param>

                  <init-param>
                          <param-name>jdbcPwd</param-name>
                          <param-value>password</param-value>
                  </init-param>

                  <load-on-startup/>
      </servlet>


And, I have:
public class PostgresqlConnection {
     private Connection conn;
     private String     user;
     private String     password;

     public Connection getConnection(String user, String password) throws 
ClassNotFoundException, SQLException {
         Class.forName("org.postgresql.Driver");
         PostgresqlDataSource dataSource = new PostgresqlDataSource();
         conn = dataSource.getConnection(user, password);
         return conn;
     }
}

I have the javax.sql.* stuff in <blah blah>/lib/ext.  Mine works fine.

-- micael

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to