<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title><![CDATA[Java Programming Forums - The Java Community - JDBC & Databases]]></title>
		<link>http://www.javaprogrammingforums.com/</link>
		<description><![CDATA[Database connection & manipulation.]]></description>
		<language>en</language>
		<lastBuildDate>Sat, 25 May 2013 22:37:55 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.javaprogrammingforums.com/images/misc/rss.png</url>
			<title><![CDATA[Java Programming Forums - The Java Community - JDBC & Databases]]></title>
			<link>http://www.javaprogrammingforums.com/</link>
		</image>
		<item>
			<title>i want to konw database connectivity with sql</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29657-i-want-konw-database-connectivity-sql.html</link>
			<pubDate>Sat, 25 May 2013 09:43:59 GMT</pubDate>
			<description><![CDATA[i am trying to connect my code with database but can't . 
pls help me to overcome this problem]]></description>
			<content:encoded><![CDATA[<div>i am trying to connect my code with database but can't .<br />
pls help me to overcome this problem</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>Kamakshi</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29657-i-want-konw-database-connectivity-sql.html</guid>
		</item>
		<item>
			<title>SImpeJDBCinsert leads to memory leak</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29578-simpejdbcinsert-leads-memory-leak.html</link>
			<pubDate>Wed, 22 May 2013 09:04:36 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I'm having issues with my code, I'm using simpleJDBCinsert in order to create new entry to mt db. But when I run my code, it freezes. 
...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I'm having issues with my code, I'm using simpleJDBCinsert in order to create new entry to mt db. But when I run my code, it freezes.<br />
<br />
Thank you for your help. <br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> @Override
    public void createMission(Mission c) {
        SimpleJdbcInsert createMiss = new SimpleJdbcInsert(dataSource).withTableName(&quot;mission&quot;).usingGeneratedKeyColumns(&quot;id&quot;);
        Map&lt;String, Object&gt; parameters = new HashMap&lt;&gt;(5);
&nbsp;
        parameters.put(&quot;Mission_Name&quot;, c.getName());
        parameters.put(&quot;Mission_Started&quot;, c.getStart());
        parameters.put(&quot;Location&quot;, c.getLocation());
        parameters.put(&quot;Mission_End&quot;, c.getEnd());
&nbsp;
        Number id = createMiss.executeAndReturnKey(parameters);
        c.setId(id.longValue());
    }</pre></div></code><hr />
</div> <br />
here is my simplejdbc query<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   btnAddMission.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
&nbsp;
                System.out.print(&quot;Enter name of the mission: &quot;);
                Scanner scan = new Scanner(System.in);
                String name = scan.nextLine();
&nbsp;
                System.out.print(&quot;Enter the Date of the mission: &quot;);
                String date = scan.nextLine();
                Date start = null;
                try {
                    start = new SimpleDateFormat(&quot;yyyy/MM/dd&quot; ).parse(date);
                } catch (ParseException e1) {
                    e1.printStackTrace();  //
  }
&nbsp;
                System.out.print(&quot;Enter the location: &quot;);
                String location = scan.nextLine();
&nbsp;
                System.out.print(&quot;Enter the exparation time: &quot;);
                String end = scan.nextLine();
               Date endD = null;
                try {
                    endD = new SimpleDateFormat(&quot;yyyy/ MM/dd&quot;).parse(end);
                } catch (ParseException e1) {
                    e1.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                }
&nbsp;
&nbsp;
                //Long id, String name, String location,Date start,Date end
                MissionManagerImpl miss = new MissionManagerImpl();
                Mission mission = new Mission((long) 0, name, location, start, endD);
&nbsp;
                miss.createMission(mission);
            }
        });</pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>justyStepi</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29578-simpejdbcinsert-leads-memory-leak.html</guid>
		</item>
		<item>
			<title>DetachedCriteria</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29570-detachedcriteria.html</link>
			<pubDate>Tue, 21 May 2013 19:43:15 GMT</pubDate>
			<description>from user u, company c where c.name = u.name 
 
how can do the same thing using DetachedCriteria, I did it using HQL. but thats not what I wanted ? 
...</description>
			<content:encoded><![CDATA[<div>from user u, company c where c.name = u.name<br />
<br />
how can do the same thing using DetachedCriteria, I did it using HQL. but thats not what I wanted ?<br />
<br />
thnx in advance</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>basoul83</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29570-detachedcriteria.html</guid>
		</item>
		<item>
			<title>Updating MySQL with user entered values</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29490-updating-mysql-user-entered-values.html</link>
			<pubDate>Thu, 16 May 2013 15:13:23 GMT</pubDate>
			<description>The first jsp page (send1.jsp) displays all data from the MySQL database, and consists of an edit button for each row. 
 
Once the user clicks on the...</description>
			<content:encoded><![CDATA[<div>The first jsp page (send1.jsp) displays all data from the MySQL database, and consists of an edit button for each row.<br />
<br />
Once the user clicks on the edit button for a particular row, the size variable of that row will be passed to the next jsp page (receive1.jsp)<br />
<br />
receive1.jsp will accept the value and then use the value for the Update PreparedStatement.<br />
<br />
When the user clicks 'update' in the 2nd jsp page, the size value which the user typed will be stored into a variable and used for the Update PreparedStatement as well.<br />
<br />
However after doing so, the UPDATE doesn't have any effect on the MYSQL database; nothing happens.<br />
<br />
Thanks for any help rendered.<br />
<br />
<b>send1.jsp</b><br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    &lt;%@ page import =&quot;java.sql.*&quot; %&gt; 
    &lt;body&gt;
    	&lt;!------------------------ Default Table title Display---------------------------------&gt;	
    	&lt;table border=&quot;1&quot;&gt;
    	&lt;tr&gt;
    	&lt;td&gt;Size&lt;/td&gt;
    	&lt;td&gt;Taste&lt;/td&gt;
    	&lt;/tr&gt;
&nbsp;
    &lt;%
&nbsp;
    PreparedStatement pstmt;
&nbsp;
    pstmt = conn.prepareStatement(&quot;Select * from shoe_db&quot;);
&nbsp;
    ResultSet rs = pstmt.executeQuery();
&nbsp;
    while(rs.next()){
       out.println(&quot;&lt;form action ='send1.jsp' method='post'&quot;);
       out.println(&quot;&lt;tr&gt;&quot;);
       out.println(&quot;&lt;td&gt;&quot; + rs.getString(&quot;size&quot;) + &quot;&lt;/td&gt;&quot;);
       out.println(&quot;&lt;td&gt;&quot; + rs.getString(&quot;taste&quot;) + &quot;&lt;/td&gt;&quot;);
       out.println(&quot;&lt;td&gt; &lt;input type='hidden' name='hidden' value='&quot;+rs.getString(&quot;size&quot;)+&quot;'&gt; &lt; input type='submit' name='editm' value='Edit'&gt;  &lt;/td&gt;&quot;);
       out.println(&quot;&lt;/tr&gt;&quot;);
       out.println(&quot;&lt;/form&gt;&quot;);
    }
    String getmov3 =&quot;&quot;;
    // check if Edit button is clicked
    if(request.getParameter(&quot;editm&quot;) != null) {
    	getmov3 = request.getParameter(&quot;hidden&quot;);
      // DEBUG
    	System.out.println(&quot;getmov3 is &quot;+getmov3);
    response.sendRedirect(&quot;receive1.jsp?getmov3=&quot;+getmov3);
    }
    //conn.close();
    %&gt;
    &lt;/table&gt;
    &lt;/body&gt;
    &lt;/html&gt;</pre></div></code><hr />
</div> <br />
<b>receive1.jsp</b><br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	&lt;%@ page import =&quot;java.sql.*&quot; %&gt; 
&nbsp;
	&lt;body&gt;
	&lt;%
	//Register JDBC driver
	Class.forName(&quot;com.mysql.jdbc.Driver&quot;);
	//Define Connection URL
	String connURL = &quot;jdbc:mysql://localhost/dumbs?user=root&amp;password=rootlah213&quot;;
	//Establish connection to URL
	Connection conn =   DriverManager.getConnection(connURL); 
	%&gt;
&nbsp;
	&lt;form action = 'receive1.jsp' method='post'&gt;
		&lt;table border=&quot;0&quot;&gt;
		&lt;tr&gt;
		&lt;td&gt;Enter Size to be changed to:&lt;/td&gt;&lt;td&gt;&lt;input type='text' size=15 name='gs' &gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		&lt;td&gt;&lt;input type='submit' size=15 name='Updatebutton' value='Update' &gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;/table&gt;
		&lt;/form&gt;
&nbsp;
&nbsp;
	&lt;%
	String sizeg = request.getParameter(&quot;getmov3&quot;);
	System.out.println(&quot;sizeg is &quot;+sizeg);
&nbsp;
	String getsize = &quot;&quot;;
	// check if Update button is clicked
	if(request.getParameter(&quot;Updatebutton&quot;) != null) {
		// get what user enterd in Size text box
		getsize = request.getParameter(&quot;gs&quot;);
		// DEBUG
		System.out.println(&quot;getsize is &quot;+getsize);
		PreparedStatement pstmt4;
&nbsp;
		pstmt4 = conn.prepareStatement(&quot;UPDATE shoe_db SET size=? WHERE size=?&quot;);
		pstmt4.setString(1,getsize);
		pstmt4.setString(2,sizeg);
		pstmt4.executeUpdate();
	}
&nbsp;
	%&gt;
&nbsp;
	&lt;/body&gt;
	&lt;/html&gt;</pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>Talksin</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29490-updating-mysql-user-entered-values.html</guid>
		</item>
		<item>
			<title>Re: Import Data from Excel to Mysql Database</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29370-re-import-data-excel-mysql-database.html</link>
			<pubDate>Thu, 09 May 2013 15:59:37 GMT</pubDate>
			<description>hello venu.. 
can u pls give me ur code for extracting data from mysql db and putting it into excel worksheet using swing.. i m in urgent need of...</description>
			<content:encoded><![CDATA[<div>hello venu..<br />
can u pls give me ur code for extracting data from mysql db and putting it into excel worksheet using swing.. i m in urgent need of it.. pls reply.. thnx</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>piya</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29370-re-import-data-excel-mysql-database.html</guid>
		</item>
		<item>
			<title>problem incrementing field in sql with java</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29188-problem-incrementing-field-sql-java.html</link>
			<pubDate>Mon, 06 May 2013 14:42:13 GMT</pubDate>
			<description>interesting... seems my logic actually works when i set the wins field to 1 before using this. when i queried the db it said that wins == 0 though......</description>
			<content:encoded><![CDATA[<div>interesting... seems my logic actually works when i set the wins field to 1 before using this. when i queried the db it said that wins == 0 though... is it returning 0 as a place holder when that value was actually undefined?<font color="Silver"><br />
<br />
--- Update ---<br />
<br />
</font>you can close this... somehow my original question text got deleted but i figured it out</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>nachos</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29188-problem-incrementing-field-sql-java.html</guid>
		</item>
		<item>
			<title>RFID Tracking using Java and Sql Databases</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29024-rfid-tracking-using-java-sql-databases.html</link>
			<pubDate>Thu, 02 May 2013 13:51:14 GMT</pubDate>
			<description>So I am building this RFID tracking system, which essentially consists of a RFID reader and tags. So I have programmed the Tags and connected the...</description>
			<content:encoded><![CDATA[<div>So I am building this RFID tracking system, which essentially consists of a RFID reader and tags. So I have programmed the Tags and connected the reader through RS-232 port of my computer.I open the hyper terminal or the console for the serial communication. Whenever the tag is detected the some ID shows up in the Hyper Terminal. That means everything is fine.<br />
<br />
Now to achieve the same in java, i.e Serial Communication. I am using javax.comm API for serial communication which is achieved from this code.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">import java.io.*;
import java.util.*;
&nbsp;
import javax.comm.*;
&nbsp;
public class SimpleRead implements Runnable, SerialPortEventListener {
static CommPortIdentifier portId;
static Enumeration portList;
&nbsp;
InputStream inputStream;
SerialPort serialPort;
Thread readThread;
&nbsp;
public static void main(String&#91;&#93; args) {
    portList = CommPortIdentifier.getPortIdentifiers();
&nbsp;
    while (portList.hasMoreElements()) {
        portId = (CommPortIdentifier) portList.nextElement();
        if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
             if (portId.getName().equals(&quot;COM1&quot;)) {
        //                if (portId.getName().equals(&quot;/dev/term/a&quot;)) {
                SimpleRead reader = new SimpleRead();
            }
        }
    }
}
&nbsp;
public SimpleRead() {
    try {
        serialPort = (SerialPort) portId.open(&quot;SimpleReadApp&quot;, 2000);
    } catch (PortInUseException e) {System.out.println(e);}
    try {
        inputStream = serialPort.getInputStream();
    } catch (IOException e) {System.out.println(e);}
try {
        serialPort.addEventListener(this);
} catch (TooManyListenersException e) {System.out.println(e);}
    serialPort.notifyOnDataAvailable(true);
    try {
        serialPort.setSerialPortParams(9600,
            SerialPort.DATABITS_8,
            SerialPort.STOPBITS_1,
            SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {System.out.println(e);}
    readThread = new Thread(this);
    readThread.start();
}
&nbsp;
public void run() {
    try {
        Thread.sleep(20000);
    } catch (InterruptedException e) {System.out.println(e);}
}
&nbsp;
public void serialEvent(SerialPortEvent event) {
    switch(event.getEventType()) {
    case SerialPortEvent.BI:
    case SerialPortEvent.OE:
    case SerialPortEvent.FE:
    case SerialPortEvent.PE:
    case SerialPortEvent.CD:
    case SerialPortEvent.CTS:
    case SerialPortEvent.DSR:
    case SerialPortEvent.RI:
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
        break;
    case SerialPortEvent.DATA_AVAILABLE:
        byte&#91;&#93; readBuffer = new byte&#91;20&#93;;
&nbsp;
        try {
            while (inputStream.available() &gt; 0) {
                int numBytes = inputStream.read(readBuffer);
            }
            System.out.print(new String(readBuffer));
        } catch (IOException e) {System.out.println(e);}
        break;
    }
}}</pre></div></code><hr />
</div> <br />
<br />
So what i need to achieve is that whenever the tag is swapped with the reader, the tagid that is recieved by us from COM port, would go into a database along with its time stamp.<br />
<br />
So I created this database by :<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Quote:</div>
	<div class="bbcode_quote printable">
		<hr />
		
			create table track(<br />
tagid number(8),<br />
timet timestamp<br />
);
			
		<hr />
	</div>
</div>So what should I do so that whenever a card is swiped this table gets entered by the tag id (received by COM port) and the time and date of the swipe (Timestamp of the swipe).<br />
<br />
Any help would be appreciated.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>rahulraina7</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29024-rfid-tracking-using-java-sql-databases.html</guid>
		</item>
		<item>
			<title>error</title>
			<link>http://www.javaprogrammingforums.com/jdbc-databases/29020-error.html</link>
			<pubDate>Thu, 02 May 2013 04:48:24 GMT</pubDate>
			<description><![CDATA[i am using jdbc and getting a error: 
 
SQLException: Incorrect integer value: 'score' for column 'Score' at row 1 
SQLException: 1366 
 
 
<div...]]></description>
			<content:encoded><![CDATA[<div>i am using jdbc and getting a error:<br />
<br />
SQLException: Incorrect integer value: 'score' for column 'Score' at row 1<br />
SQLException: 1366<br />
<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sqlState.executeUpdate(&quot;insert into Score values(id, userNameTemp, score)&quot;);</pre></div></code><hr />
</div> <br />
<br />
id, userNameTemp, score are variables.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/jdbc-databases/"><![CDATA[JDBC & Databases]]></category>
			<dc:creator>game06</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/jdbc-databases/29020-error.html</guid>
		</item>
	</channel>
</rss>
