simple insert operation
От | Aydın Toprak |
---|---|
Тема | simple insert operation |
Дата | |
Msg-id | 431FEF3D.6050906@intengo.com обсуждение исходный текст |
Ответы |
Re: simple insert operation
Re: simple insert operation Re: simple insert operation |
Список | pgsql-jdbc |
Hii guys, I am very newbie about postgresql and I am making practice, however I couldnt been able to insert a simple item to my DB via jdbc... here is my code for insertion... Class.forName("org.postgresql.Driver"); String connectionStr = "jdbc:postgresql://localhost:5432/XXXX"; Connection connection = java.sql.DriverManager.getConnection(connectionStr, "XXXX", "XXXX"); String sqlQuery = "INSERT INTO passTable (idCol , pass) VALUES (3, 5)"; PreparedStatement query = connection.prepareStatement(sqlQuery); query.executeUpdate(); connection.close(); but I cant compile it the errors ------------------------------------------------------------------------------------------- form.java:26: unreported exception java.lang.ClassNotFoundException; must be cau ght or declared to be thrown Class.forName("org.postgresql.Driver"); ^ form.java:28: unreported exception java.sql.SQLException; must be caught or decl ared to be thrown Connection connection = java.sql.DriverManager.getConnection(con nectionStr, "XXXX", "XXXX"); ^ form.java:30: unreported exception java.sql.SQLException; must be caught or decl ared to be thrown PreparedStatement query = connection.prepareStatement(sqlQuery); ^ form.java:31: unreported exception java.sql.SQLException; must be caught or decl ared to be thrown query.executeUpdate(); ^ form.java:32: unreported exception java.sql.SQLException; must be caught or decl ared to be thrown connection.close(); ^ 5 errors ------------------------------------------------------------------------------------------- what is the problem I am stuck with it..
В списке pgsql-jdbc по дате отправления: