Joe,
Here is an example of how I connect to MS SQL7.0 using weblogic's connection
pool. Make sure you have downloaded the latest driver that supports
varchar(8000). Version: 4.5.1.1
Tom Kochanowicz
############################################################################
############
protected String dbURL = "jdbc:weblogic:pool:myPool";
public void init(ServletConfig config) throws ServletException
{
super.init(config);
// use println statements to send status messages to web server
console
try {
System.out.println("SubmitServlet init: Start");
p.put("user", "UserNameHere");
p.put("password", "YourPassword");
// FOR TESTING // Compiler.disable(); //turn off JIT so we
can see line
numbers when debugging
dbConnection = null;
Class.forName("weblogic.jdbc.pool.Driver").newInstance();
Connection dbConnection =
DriverManager.getConnection("jdbc:weblogic:pool:myPool", p);
System.out.println("SubmitServlet init: Loading Database
Driver");
System.out.println("SubmitServlet init: Getting a connection
to - " +
dbURL);
synchronized(dbConnection){
// Put prepared statement below if you want or synchonize only the prepared
statements(better choice).
....
....
....
System.out.println("SubmitServlet init: End");
}
}
catch (Exception e)
{
cleanUp();
e.printStackTrace();
}
}
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Joe
Oh
Sent: Tuesday, March 21, 2000 2:54 PM
To: [EMAIL PROTECTED]
Subject: Error with weblogic driver and MS SQL7.0
Hello, everyone.
I'm implementing one servlet that connect to MS SQL server7.0 with your
weblogic db driver.
Here is my part of codes:
try
{
trace("Trying the JDBC driver.");
Class.forName(szDriver);
String szURL = "jdbc:" + szDriverType + ":" + szDatabase;
trace("Getting a database connection.");
Connection dbConnect = DriverManager.getConnection(
szURL, szUserName, szPassword);
checkForWarning(dbConnect.getWarnings()); //<--The
error(warning) occurs here!!!
trace("Connected to database.");
return dbConnect;
}
catch(SQLException eSQLException)
{
trace("An SQL Exception was thrown:\n" + eSQLException);
}
catch (Exception eException)
{
// some other kind of exception occurred so dump the call stack
eException.printStackTrace();
}
While I'm connecting to DB with that code, I keep getting the error(warning)
below.
==================================
SQL State : null
Message : Could not determine default character set because
weblogic.b.j:Database meta data query failed.
Vendor : 0
==================================
Please help, it's urgent.
Thanks.
Joe Oh
Ignition State
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html