<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "jdbc-mysql statement, timstamp now()"]]></title>
		<link>http://forums.visual-paradigm.com/posts/14.html</link>
		<description><![CDATA[Latest messages posted in the topic "jdbc-mysql statement, timstamp now()"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>jdbc-mysql statement, timstamp now()</title>
				<description><![CDATA[ Hi, <br> <br> This is a mysql-jdbc question. I am trying to issues a jdbc statement  to add a row into the mysql table named ‘registration’. There are three columns in the table. The last one is a timestamp.<br> <br> The following is the jdbc statement in my java code: <br> <br> PreparedStatement pstmt = con.prepareStatement(<br> 	"insert into registration(username, password, timestamp) values (?, ?, ?)");<br> <br>   pstmt.setString(1, username);<br>   pstmt.setString(2, password);<br>   pstmt.setString(3, “now()”);<br>   pstmt.executeUpdate();<br> <br> <br> With this statement, the timestamp in the table is always set to ‘0000000000’. I know the problem is related to how to format now() in a right way, I have tried “now()”, ‘now()’, and now(), and none of them work.<br> <br> Could any one advice how to make this right?<br> <br> Thanks in advance,<br> <br> James]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/746#2240.html</guid>
				<link>http://forums.visual-paradigm.com/posts/746#2240.html</link>
				<pubDate><![CDATA[Mon, 16 Aug 2004 00:00:00]]></pubDate>
				<author><![CDATA[ jameshao]]></author>
			</item>
			<item>
				<title>Re: jdbc-mysql statement, timstamp now()</title>
				<description><![CDATA[ Hi James,<br> <br> I presume you are using the "mysql-connector-java-3.0.14-production-bin.jar" of some sort.<br> <br> Now, I do not understand where you got the method "now()".  Which class does it come from?<br> <br> More information is required.<br> Thanks.<br> <br> Martyn]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/746#2241.html</guid>
				<link>http://forums.visual-paradigm.com/posts/746#2241.html</link>
				<pubDate><![CDATA[Wed, 18 Aug 2004 00:00:00]]></pubDate>
				<author><![CDATA[ martyn]]></author>
			</item>
			<item>
				<title>Re: jdbc-mysql statement, timstamp now()</title>
				<description><![CDATA[ This should work nicely:<br> <br> PreparedStatement pstmt = con.prepareStatement(<br> "insert into registration(username, password, timestamp) values (?, ?, now())");<br> <br> pstmt.setString(1, username);<br> pstmt.setString(2, password);<br> pstmt.executeUpdate();]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/746#2242.html</guid>
				<link>http://forums.visual-paradigm.com/posts/746#2242.html</link>
				<pubDate><![CDATA[Tue, 31 Aug 2004 00:00:00]]></pubDate>
				<author><![CDATA[ Emma Hayes]]></author>
			</item>
			<item>
				<title>Re: jdbc-mysql statement, timstamp now()</title>
				<description><![CDATA[ This should work nicely:<br> <br> PreparedStatement pstmt = con.prepareStatement(<br> "insert into registration(username, password, timestamp) values (?, ?, now())");<br> <br> pstmt.setString(1, username);<br> pstmt.setString(2, password);<br> pstmt.executeUpdate();]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/746#2243.html</guid>
				<link>http://forums.visual-paradigm.com/posts/746#2243.html</link>
				<pubDate><![CDATA[Tue, 31 Aug 2004 00:00:00]]></pubDate>
				<author><![CDATA[ Emma Hayes]]></author>
			</item>
			<item>
				<title>Re: jdbc-mysql statement, timstamp now()</title>
				<description><![CDATA[ now() is a mysql-function, not a java-function. So you should change you code to:<br> <br> PreparedStatement pstmt = con.prepareStatement(<br> "insert into registration(username, password, timestamp) values (?, ?, now())");<br> <br> pstmt.setString(1, username);<br> pstmt.setString(2, password);<br> pstmt.executeUpdate();]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/746#2244.html</guid>
				<link>http://forums.visual-paradigm.com/posts/746#2244.html</link>
				<pubDate><![CDATA[Tue, 31 Aug 2004 00:00:00]]></pubDate>
				<author><![CDATA[ Emma Hayes]]></author>
			</item>
			<item>
				<title>Re:jdbc-mysql statement, timstamp now()</title>
				<description><![CDATA[ I'm not sure what context this ps is being used in, but I want something similar for the default value to be generated when a new row is inserted into the database.<br> The solution you have given will probably work but it goes against the MDA concept and isn't round trip reversible.<br> How do I add a generated timestamp value for this field that is fully reversible and specify it from the model rather than the code?]]></description>
				<guid isPermaLink="true">http://forums.visual-paradigm.com/posts/746#20388.html</guid>
				<link>http://forums.visual-paradigm.com/posts/746#20388.html</link>
				<pubDate><![CDATA[Thu, 6 Dec 2007 10:31:18]]></pubDate>
				<author><![CDATA[ Anonymous]]></author>
			</item>
	</channel>
</rss>