You may need to set your database context as well. 

I.e.
DriverManager.getConnection("jdbc:microsoft:sqlserver://128.91.107.105:1
433;User=sa;Password=duder;DatbaseName=myDB");

=========================================
Mark Clarke - Exotic Pets
E-Mail:  [EMAIL PROTECTED]
WWW:     www.ExoticPets.co.za
=========================================


> -----Original Message-----
> From: laikiow [mailto:[EMAIL PROTECTED] 
> Sent: 24 February 2003 05:05
> To: Tomcat Users List
> Subject: Re: having trouble using tomcat 
> 
> 
> try this... 
> DriverManager.getConnection("jdbc:microsoft:sqlserver://128.91
> .107.105:1433;User=sa;Password=duder");
> DriverManager.getConnection("jdbc:microsoft:sqlserver://128.91
> .107.105:1433,User=sa,Password=duder");
> ----- Original Message ----- 
> From: "Michael Ni" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, February 24, 2003 8:36 AM
> Subject: having trouble using tomcat 
> 
> 
> > hi im new to tomcat.  im having trouble using jsp pages to query my
> > microsoft sql server 2000.  does anyone know how to do 
> this?  i've followed 
> > the microsoft instructions but it doens't work still.  i 
> created the 
> > CLASSPATH environement variables, but my jsp code looks 
> like it doens't work
> > 
> > 
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <%@ 
> > page import="java.sql.*, java.util.*" errorPage="error.jsp" %>
> > 
> > 
> > <html>
> > <head>
> >   <title>Current Election Results:</title>
> > </head>
> > 
> > <body>
> > 
> > <h2>Here are the latest voting results... </h2>
> > 
> > <%
> >     Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
> >     Connection con =
> > 
> DriverManager.getConnection("jdbc:microsoft:sqlserver://128.91
> .107.105:1433;User=sa;Password=duder");
> > 
> >     Statement stmt = con.createStatement();
> >     String queryStr = "SELECT username FROM player";
> >     ResultSet rs = stmt.executeQuery(queryStr);
> > %>
> > <table border="0" cellspacing="0" cellpadding="2">
> > <tr bgcolor="lightgrey">
> > <th align="left">Candidate</th>
> > <th align="right">Total Votes</th>
> > </tr>
> > 
> > <%  while (rs.next()) {
> >       String firstname = rs.getString(1);
> > 
> > %>
> > 
> > <tr>
> > <td><%= firstname %> </td>
> > <td align="right">dfd</td>
> > </tr>
> > <%
> >     }  // end while()
> > 
> >     // clean up.
> >     if (rs!=null) rs.close();
> >     if (stmt!=null) stmt.close();
> >     if (con!=null) con.close();
> > %>
> > </table>
> > </body>
> > </html>
> > 
> > 
> > 
> > 
> > _________________________________________________________________
> > MSN 8 with e-mail virus protection service: 2 months FREE*
> > http://join.msn.com/?page=features/virus
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to