By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,759 Members | 959 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,759 IT Pros & Developers. It's quick & easy.

sql connectivity using jsp

kaleeswaran
100+
P: 132
i am creating login form using jsp..i try to connect data base using sql..
i hve an error like this:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified and
this is my code:
<%@ page language="java" contentType="text/html" import="java.sql.*" %>
<html>
<head><title>Login Form </title></head>
<body><br><br>
<span style="font:bold 15pt black">
<div style="border:double 9 ;text-align:center">
<form>
UserName:<input type="text" name="user" value=""><br><br>
PassWord:<input type="password" name="pword" value="" length=6><br><br>
<input type="submit" value="Submit">
</span>
</form>
</div>
<%
Connection con=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:sathish ","sathish","jaya");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select msg from login");
ResultSetMetaData rsmd=rs.getMetaData();
int count=rsmd.getColumnCount();
out.println(count);
%>
<%
while(rs.next())
{
out.println("rs.getString(3)");
}
rs.close();
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>


</body>
</html>

plz solve my problem
May 16 '07 #1
Share this Question
Share on Google+
4 Replies


rsrinivasan
100+
P: 221
i am creating login form using jsp..i try to connect data base using sql..
i hve an error like this:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified and
this is my code:
<%@ page language="java" contentType="text/html" import="java.sql.*" %>
<html>
<head><title>Login Form </title></head>
<body><br><br>
<span style="font:bold 15pt black">
<div style="border:double 9 ;text-align:center">
<form>
UserName:<input type="text" name="user" value=""><br><br>
PassWord:<input type="password" name="pword" value="" length=6><br><br>
<input type="submit" value="Submit">
</span>
</form>
</div>
<%
Connection con=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:sathish ","sathish","jaya");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select msg from login");
ResultSetMetaData rsmd=rs.getMetaData();
int count=rsmd.getColumnCount();
out.println(count);
%>
<%
while(rs.next())
{
out.println("rs.getString(3)");
}
rs.close();
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>


</body>
</html>

plz solve my problem
Hi,
Do you know what is "sathish" and "sathish" and "jaya" in your code? If you know you can solve the problem..

Expand|Select|Wrap|Line Numbers
  1. con=DriverManager.getConnection("jdbc:odbc:sathish","sathish","jaya");
Thanks,
May 16 '07 #2

10K+
P: 13,264
i am creating login form using jsp..i try to connect data base using sql..
i hve an error like this:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified and
this is my code:
<%@ page language="java" contentType="text/html" import="java.sql.*" %>
<html>
<head><title>Login Form </title></head>
<body><br><br>
<span style="font:bold 15pt black">
<div style="border:double 9 ;text-align:center">
<form>
UserName:<input type="text" name="user" value=""><br><br>
PassWord:<input type="password" name="pword" value="" length=6><br><br>
<input type="submit" value="Submit">
</span>
</form>
</div>
<%
Connection con=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:sathish ","sathish","jaya");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select msg from login");
ResultSetMetaData rsmd=rs.getMetaData();
int count=rsmd.getColumnCount();
out.println(count);
%>
<%
while(rs.next())
{
out.println("rs.getString(3)");
}
rs.close();
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>


</body>
</html>
plz solve my problem
Did you create the datasource first then?
May 16 '07 #3

kaleeswaran
100+
P: 132
Hi,
Do you know what is "sathish" and "sathish" and "jaya" in your code? If you know you can solve the problem..

Expand|Select|Wrap|Line Numbers
  1. con=DriverManager.getConnection("jdbc:odbc:sathish","sathish","jaya");
Thanks,
sorry for my late replay....
sathsh is my dsn name and
my sql user name....
and jaya is my password...
still i have a problem.....
headache for me...........
May 17 '07 #4

kaleeswaran
100+
P: 132
Did you create the datasource first then?
yes, i created dsn name..........
but still having a problem..........
May 17 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.