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();
}
}
}