It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Java Forum

error on jsp link to database

error on jsp link to database

Postby dyingsky on Tue Apr 03, 2007 5:56 pm

there are some errors happen in my jsp which link to database ,the code is here:

<%@ page import="java.sql.*" contentType="text/html;charset=gb2312" %>
<%
out.println("ok<br>");
%>
<%
String url="jdbc:odbc:LBSource";
String username="LUser";
String password="1111111";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception e)
{
out.println("some wrong have happen in forname");
}
try
{
Connection con=DriverManager.getConnection(url,username,password);
}
catch(Exception e)
{
out.println("some wrong have happen in getconnection");
}

try
{
Statement stm=con.createStatement();
}

catch(Exception e)
{
out.println("some wrong have happen in createstatement");
con.close();
}
try
{
String sql="select * from book_table where bookid>3";
ResultSet rs=stm.executeQuery(sql);
}
catch(Exception e)
{
out.println("some wrong have happen in executequer");
stm.close();
con.close();
}

%>
<%
out.println("<br>ok");
%>

thanks !!
dyingsky
 
Posts: 4
Joined: Sun Mar 25, 2007 6:31 pm
Location: China.GuanZhou

Postby ggomez on Tue Apr 17, 2007 5:50 am

it would be helpfull if you posted what errors you get

note: the java code will run on the server side.
so make the program like your using the database in localhost.
ggomez
 
Posts: 45
Joined: Tue Apr 17, 2007 3:30 am
Location: !!!!!MéXiCo¡¡¡¡¡¡

hi

Postby Rajesh Kochher on Sun Apr 29, 2007 3:29 pm

Helnen,

I am new in the Java but I am trying tom foind out the problem.
And will let you know whats the problem with this,..If wnat to chat on yahoo then let me know.


thanks,
Rajesh
Rajesh Kochher
 
Posts: 3
Joined: Sun Apr 29, 2007 3:07 pm
Location: Mo

hi

Postby Rajesh Kochher on Sun Apr 29, 2007 3:30 pm

Helnen,

I am new in the Java but I am trying tom foind out the problem.
And will let you know whats the problem with this,..If wnat to chat on yahoo then let me know.


thanks,
Rajesh
Rajesh Kochher
 
Posts: 3
Joined: Sun Apr 29, 2007 3:07 pm
Location: Mo


Who is online

Users browsing this forum: No registered users and 1 guest