CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 converting string to oracle date format using JSP

Print topic Send  topic

Author Message
shirisha19

Posts: 7
Posted: 08/30/2005, 1:16 AM

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

<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");


out.println("hello" );
Connection con = DriverManager.getConnection("jdbc:odbc:kavitha","scott" , "tiger");
PreparedStatement pstmt=con.prepareStatement("insert into t1 values(?,?)");
out.println("hello java world");

java.sql.Date d = new java.sql.Date(1990,10,29);
pstmt.setDate(1,d);



pstmt.setString(2,"10:20:30");

out.println("hello java world" +d);

con.close();
pstmt.close();
out.println("hello java world" );

}catch(Exception e)
{
e.printStackTrace();
out.println("exception occured"+e);
}
%>

using this code we are unable to insert into table.and code is excuting but year& month not printing correctly.we are using oracle8i.
please any body tell me solution using jsp.
please its very urgent................
View profile  Send private message
vidyasagar

Posts: 7
Posted: 11/29/2005, 2:31 AM

Hi,shirisha

Are Database column(s) types are DATE type.
if you not declare DATE type first declare the DATE type.

Note: First analyze the problum and its area. Send problum(s) clearly.

all the best
_________________
Thank you.
vidya sagar
View profile  Send private message
eserver221
Posted: 12/18/2005, 4:39 PM

Look at the j2se manual, there is the class java.sql.Date, and refer to the method valueOf() to connstruct the data object.
BTW, you never perform pstmt.executeUpdate() in your code!!!
kamaraj
Posted: 12/18/2005, 9:42 PM

I want to complete coding for database connection(insert,delete,update,find)using jsp and oracle
peterr


Posts: 5971
Posted: 12/19/2005, 1:01 AM

Code examples for executing SQL are in CodeCharge Studio documentation at http://docs.codecharge.com/studio3/html/ProgrammingTech...eCustomSQL.html
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.