java equivalent of ado components

[nobr]hi,

im posting for the first time,infact this is the first time i've joined a technical forum. My difficulty is that i just know basic java but have been asked to convert quite a few asp pages to jsp. im working it out but im in a fix. Can somebody tell me the equivalent java for the following snippet. Are recordset and resultset equivalent?

Function OpenConnection()

Set cn = Server.CreateObject("ADODB.Connection")

cn.Open"DRIVER={SQL Server};SERVER=demodarshak;UID=gscas;PWD=GSCAS;DATABASE=gscas"

'cn.Open "DSN=gscas;UID=gscas;PWD=gscas;"

If cn.State = 0 Then

Response.Write"<BR><CENTER><b>ISO Management System.</b><BR><BR>"

Response.Write"<BR><CENTER><b>Database connectivity failed.</b><BR><BR>"

Response.Write"<BR><CENTER><b>Please Try Later.</b><BR><BR>"

Response.end

End If

End Function

Function CurrentDate()

set rsDate = server.CreateObject ("ADODB.recordset")

on error resume next

rsDate.Open"SELECT convert(varchar(12),getdate(),103) as CurrentD",cn

CurrentDate = rsDate.fields("CurrentD")

End Function

[/nobr]

[1495 byte] By [lokonfusea] at [2007-11-27 8:00:42]
# 1

ResultSet's are similar to Recordset's.

Get your database connection established.

Connection connection = getDbConnection();

Statement statement = connection.createStatement();

ResultSet resultSet = statement.executeQuery( "SELECT convert(varchar(12),getdate(),103) as CurrentD" );

if ( resultSet.next() )

{

Date date = resultSet.getDate( "CurrentD" );

}

resultSet.close();

statement.close();

connection.close();

bryanoa at 2007-7-12 19:42:43 > top of Java-index,Java Essentials,New To Java...
# 2
1. If you're on a JSP 2.0 enabled server then use the the SQL tags for "quit a few APS pages"... which one presumes doesn't constitute a system.2. If you're not on a JSP 2.0 enabled server then upgrade. Goto 1.Seriously.
corlettka at 2007-7-12 19:42:43 > top of Java-index,Java Essentials,New To Java...