Προς το περιεχόμενο

boh8eia gia connectivity mssql 2000 me jsp


Vasileios

Προτεινόμενες αναρτήσεις

Δημοσ.

paidia kalhspera.

se liges meres paradidw thn ptyxiakh mou kai ayto poy mou exei meinei einai na dhmiourghsw mia web page i opoia 8a exei ena log in poly basiko to opoio 8a elegxei gia username kai password kai epeita 8a petaei ton xrhsth sthn antistoixh selida.

to problhma mou einai oti exw prospa8hsei kai exw balei mesa sto coding apeirous Drivers kai den douleuei kanenas(mou leei unable to load MSSQL database driver)

th selida thn exw grapsei se jsp.

uparxei kamia boh8eia?

sas eyxaristw kai elpizw na upar3ei kapoia boh8eia

Δημοσ.

δεν μας λες πολλες πληροφοριες...

 

1. Τι συστημα χρησιμοποιηεις (λειτουργικο?

2. Αν ειναι Windows εχεις φιαξει καταχωρηση για User Data Source ετσι ωστε να φορτωσει ο driver ( Administration Tools -> Data Sources (ODBC) ).

http://support.microsoft.com/default.aspx?scid=kb;en-us;305599&sd=tech

 

3. δειξε τον κωδικα...αφου βεβαια..εχεις κανει τα παραπανω με το data source και τεσταρει την βαση για τα απαιραιτητα δικαιωματα και οτι φυσικα το USer DSN. δουλευει. κτλ κτλ

Δημοσ.

loipon to html arxeio kai to jsp ta perilambanw argotera

xrhsimopoiw windows XP kai apoti mou eipes prohgoumenos ta eixa kanei kai to onoma tou dsn einai testing

8elw mono na se enhmerwsw oti to onoma ths databases mou einai GHS, username einai to sa kai password to exw keno.

8elw na trabaw oti uparxei sto trapezi patvisit an ginei eystoxo to log in

san username kai password 8a dinei o user apo to trapezi patients ta:username=pat_fname

password=pat_lname

 

ayto mou exei meinei mono apo to project moy.an brw akrh 8a eimai poly xaroumenos

kai pali se eyxaristw poly gia to endiaferon

 

vas.html

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>vas.html</title>

 

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="this is my page">

 

 

<link rel="stylesheet" type="text/css" href="./style/ghs.css">

 

</head>

 

<body class="authenticate">

<H1> GHS Greek Health system</H1>

 

<form name="input" action="Authenticate.jsp" method="post">

 

<table class="authenticate">

<tr>

<td colspan="2" class="authenticateheading">

<img src="building.gif"/>

GHS

</td>

</tr>

<tr>

<td> Username: </td>

<td> <input type="text" name="username" maxlength="15" size="10"> </td>

</tr>

<tr>

<td> Password: </td>

<td>

<input type="password" name="password" maxlength="15" size="10">

</td>

</tr>

<tr>

<td colspan="2" class="authenticatesubmit"> <input type="submit" value="Submit"> </td>

</tr>

 

</table>

</form>

</body>

</html>

 

Authenticate.jsp

 

<%@ page language="java"%>

<%@ page import="java.sql.*" %>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html:html locale="true">

<head>

<html:base />

 

<title>Authentication of whatever</title>

 

 

</head>

 

<body>

<% String username = request.getParameter("username").toString(); %>

<% String password = request.getParameter("password").toString(); %>

 

<%

try {

String sDBDriver = "app.jdbc.driver=net.sourceforge.jtds.jdbc.Driver";

String sConnStr = "jdbc:jtds:sqlserver://VASILEIO:1433;DatabaseName=GHS;User=sa;Password=;";

 

//String sDBDriver = "com.mysql.jdbc.Driver";

//String sConnStr = "jdbc:mysql://localhost:3306;roof4life;DatabaseName=roof4life;User=testaccount;Password=password;";

 

 

 

Class.forName("sDBDriver");

 

 

 

java.sql.Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver//VASILEIO:1433/GHSe","sa","");

java.sql.Statement stmt = conn.createStatement();

String statement = "select * from patvisit where pat_fname=\"" + username + "\"";

 

java.sql.ResultSet rs = stmt.executeQuery(statement);

if (rs.next()) {

 

String passwordEntered = rs.getString("PASS");

if (passwordEntered.equals(password))

{

 

out.println("Welcome " + rs.getString("FIRSTNAME") + "<br><br><br>");

 

out.println("<table>");

out.println("<tr>");

out.println("<td>");

out.println(rs.getString("FIRSTNAME") + "<br>");

out.println("</td>");

out.println("<td>");

out.println(rs.getString("SURNAME") + "<br>");

out.println("</td>");

out.println("<td>");

out.println(rs.getString("EMAIL") + "<br>");

out.println("</td>");

out.println("</tr>");

out.println("</table>");

}

else

{

out.println("Wrong password");

}

 

 

 

}

else

{

out.println("No such user");

}

 

}

catch (ClassNotFoundException cnfe)

{

System.err.println("Unable to load MSSQL database driver!");

System.err.println("ClassNotFoundException: " + cnfe.getMessage());

}

%>

 

 

</body>

</html:html>

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...