I misunderstood that MS JDBC Driver should be the best for its MS SQL
Server. Sorry. Your instruction is very helpful. Now I decide to not use the
MS driver for MS SQL Server. I have successfully created the Pool with
net.sourceforge.jtds.jdbc.Driver.
Thank you.
-Original Message-
Should I put it in tomcat\webapps\ROOT\WEB-INF\web.xml? (my jsp file using
Database connection is in ROOT/zuo), but in this web.xml, I already have:
resource-ref
descriptionSQL Server DataSource/description
res-ref-namejdbc/dbName/res-ref-name
Try this code instead:
Context ctx = new InitialContext();
if (ctx == null) {
System.err.println(Conn.getConn ctx is null);
throw new Exception(Boom - No Context);
}
DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/dbName);
if (ds != null)
connection = ds.getConnection();
I run this
Thank you very much for your reply on Sunday.
The error is Name jdbc is not bound in this Context at ctx.lookup. In both
server.xml and web.xml, the type is
com.microsoft.jdbcx.sqlserver.SQLServerDataSource. Even I use the code:
envCtx = (Context) initCtx.lookup(java:comp/env);
ds =
why not use jtds instead http://jtds.sourceforge.net/
## download the jtds jar
http://heanet.dl.sourceforge.net/sourceforge/jtds/jtds-0.7.1.jar
## place it in your common/lib
## server.xml
Resource name=jdbc/DirectSQL auth=Container
type=javax.sql.DataSource/
ResourceParams
Daxin,
I think this would be well worth your time and effort to change to this. I
was unaware of it or I would have recommended it.
The reason for the other stuff you were asking about was because that is how
microsoft had set it up to be used.
This should give much cleaner and portable code.
I thought Microsoft was the best.
My jsp file is in tomcat\webapps\ROOT\zuo. In my
tomcat\webapps\ROOT\WEB-INF\web.xml, there is no context block, should I
create one or use resource-ref?
If I need ot create a context block, Is the code bellow correct:
context path=/zuo docBase=ROOT debug=0
On 5/3/2004 9:31 AM, Daxin Zuo wrote:
I thought Microsoft was the best.
if thats what you think, i guess you should stick with dotNet since with
that you will have an all microsoft retrofitted program (e.g drivers,
components, etc) :-)
My jsp file is in tomcat\webapps\ROOT\zuo. In my