0

I have been trying to insert,update,delete,select with separate queries.But when i try to write a query after a pre-written query
i get an error that the string is predefined.I am working on a PBL project so i have to show all that in one program itself.
Here is the current code:

package postgresqlconnectivity;

import java.sql.*;

public class Postgresqlconnectivity 
{
    public static void main(String[] args) 
    {
        try
        {
            Class.forName("org.postgresql.Driver");
            Connection con=DriverManager.getConnection("jdbc:postgresql://localhost:5432/Branch","postgres","postgres");            
            if(con!=null)
                System.out.println("Connected");

            Statement st=con.createStatement();
            String sql="insert into Book values(9612,'QWERTY','AB','ABC',10.96,'Y')";

            st.execute(sql);
        }
        catch(Exception ee)
        {
            ee.printStackTrace();
        }    
    }

}
1
Contributor
1
Reply
7
Views
1 Year
Discussion Span
Last Post by sumod
0

without just viewing please reply guys.....!!!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.