<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TechPitcher &#187; Php</title>
	<atom:link href="http://www.techpitcher.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.techpitcher.com</link>
	<description></description>
	<lastBuildDate>Sat, 29 May 2010 13:50:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Connecting to mysql database</title>
		<link>http://www.techpitcher.com/connecting-to-mysql-database.html</link>
		<comments>http://www.techpitcher.com/connecting-to-mysql-database.html#comments</comments>
		<pubDate>Sun, 16 Nov 2008 13:28:05 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://techpitcher.com/?p=89</guid>
		<description><![CDATA[Below is the code for creating mysql connection in java and php.
Please make sure that mysql-connector-java-5.0.6-bin.jar is in class path.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class MySqlConnectionTest {
    public static void main(String[] args) {
        Connection connection = null;

        try {
 [...]]]></description>
			<content:encoded><![CDATA[<p>Below is the code for creating mysql connection in java and php.<br />
Please make sure that mysql-connector-java-5.0.6-bin.jar is in class path.</p>
<pre class="brush: java;">
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class MySqlConnectionTest {
    public static void main(String[] args) {
        Connection connection = null;

        try {
            Class.forName(&quot;com.mysql.jdbc.Driver&quot;).newInstance();
            // We want to connect to a database name 'test' in mysql.
            connection = DriverManager.getConnection(&quot;jdbc:mysql://127.0.0.1:3306/test&quot;, &quot;root&quot;, &quot;root&quot;);

            if (!connection.isClosed()) {
                System.out.println(&quot;Successfully connected to MySQL server...&quot;);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (connection != null) {
                    connection.close();
                }
           } catch (SQLException e) {
       }
    }
  }
}
</pre>
<p>Below is the code in php for mysql connection.</p>
<pre class="brush: php;">
&lt;?php
    $hostname='localhost'; //// specify host
    $user='root'; //// database user name
    $password='root'; //// database password
    $database='test'; //// database name
    $connection = mysql_connect(&quot;$hostname&quot; , &quot;$user&quot; , &quot;$passwprd&quot;)
    or die (&quot;Unable connect to MySQL&quot;);
    $db = mysql_select_db($database , $connection) or die (&quot;Can't find database.&quot;);
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.techpitcher.com/connecting-to-mysql-database.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
