C
Clive_
Hi,
Does anyone know an example showing how to pass a database variable to
a public variable??
I would like to run a java file or JSP, passing <%= rs.getInt(1)%> to
a servlet???
The servlet would store the data, which could be retrieved using
getAttribute.
Thanks
Clive
<%
String connectionUrl =("jdbc:jtds:sqlserver://localhost:1032/");
String dbName="Calibration";
String driver="net.sourceforge.jtds.jdbc.Driver";
String user="aaaa";
String password="user";
// Establish the connection.
Class.forName(driver).newInstance();
con = DriverManager.getConnection(connectionUrl
+dbName,user,password);
stmt = con.createStatement() ;
rs = stmt.executeQuery(querySQL) ;
ResultSetMetaData rsmd = rs.getMetaData() ;
for(int i = 1 ; i <= rsmd.getColumnCount() ; i++) {
%>
<% } %>
</tr>
<% while(rs.next()) { %>
<tr>
<td> <%= rs.getInt(1)%> </td>
<td> <%= rs.getString(2) %> </td>
</tr>
<br>
<% }
con.close();
con = null;
%>
Does anyone know an example showing how to pass a database variable to
a public variable??
I would like to run a java file or JSP, passing <%= rs.getInt(1)%> to
a servlet???
The servlet would store the data, which could be retrieved using
getAttribute.
Thanks
Clive
<%
String connectionUrl =("jdbc:jtds:sqlserver://localhost:1032/");
String dbName="Calibration";
String driver="net.sourceforge.jtds.jdbc.Driver";
String user="aaaa";
String password="user";
// Establish the connection.
Class.forName(driver).newInstance();
con = DriverManager.getConnection(connectionUrl
+dbName,user,password);
stmt = con.createStatement() ;
rs = stmt.executeQuery(querySQL) ;
ResultSetMetaData rsmd = rs.getMetaData() ;
for(int i = 1 ; i <= rsmd.getColumnCount() ; i++) {
%>
<% } %>
</tr>
<% while(rs.next()) { %>
<tr>
<td> <%= rs.getInt(1)%> </td>
<td> <%= rs.getString(2) %> </td>
</tr>
<br>
<% }
con.close();
con = null;
%>