java.sql.SQLException [Microsoft][ODBC Driver Manag
- From: "Kermit Piper" <dice_response@xxxxxxxxxxx>
- Date: 9 Jun 2006 22:58:21 -0700
OK, I've see a lot of stuff out there on this error:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified.
The only definitive solution I can find is going to Control
Panel-->Administrative Tools-->Data Sources(OBDC)-->System DSN-->etc. I
did this and the connection tests fine! This is not the cause of the
error in this case!! So, given what I have explained and the snippet
below, can someone please offer some help in resolving this. I am
running in the following environment:
Windows XP Pro, SQL Server 2000, JBoss 4.0.2, JDK 150_07.
1. created my database
2. then creates a system DSN.
3. and did the required modifications in it.
// JDBC:ODBC bridge using api and using table:
This method is used in my LoginServlet:
public String validateUser(String inputUserid, String inputPwd) throws
SQLException
{
String returnString = null;
String dbUserid = "testuser";
String dbPassword = "password" ;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException cnfe)
{
System.out.println(cnfe);
}
try
{
Connection con = DriverManager.getConnection("jdbc:odbc:LocalServer",
dbUserid ,dbPassword);
Statement stmt = con.createStatement();
String sql = "select USERID from USERTABLE where USERID = '" +
inputUserid + "' and PASSWORD = '" + inputPwd +"' ;" ;
ResultSet rs = stmt.executeQuery(sql);
if (rs.next())
{
returnString = rs.getString("USERID");
}
stmt.close();
con.close();
}
catch (SQLException sqle)
{
System.out.println(sqle);
}
return returnString ;
}
Any help would be greatly appreciated.
Thanks,
KP
.
- Follow-Ups:
- Re: java.sql.SQLException [Microsoft][ODBC Driver Manag
- From: Kermit Piper
- Re: java.sql.SQLException [Microsoft][ODBC Driver Manag
- Prev by Date: Re: Java code generation from sql
- Next by Date: Re: java.sql.SQLException [Microsoft][ODBC Driver Manag
- Previous by thread: Java code generation from sql
- Next by thread: Re: java.sql.SQLException [Microsoft][ODBC Driver Manag
- Index(es):
Relevant Pages
|