Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- out.println("into try block...");
- Class.forName(driver);
- out.println("found the driver....");
- conn=DriverManager.getConnection("jdbc:postgresql:postgres",
- "postgres",
- "12345");
- out.println("connection");
- sql=conn.createStatement();
- out.println("statement created");
- String insert = "insert into spatial_ref_sys(point, coordinates) values(type, "+ ")";
- out.println("not a problem...");
- //System.out.println(fst);
- }
- catch(SQLException | ClassNotFoundException e)
- {
- e.printStackTrace();
- System.out.println(e.getClass().getName()+" "+e.getMessage());
- }
- try
- { Class.forName("org.postgresql.Driver");
- conn=DriverManager.getConnection(url,username, password);
- sql=conn.createStatement();
- //result1 = "insert into test(feature) values(ST_GeomFromText("+data+"))";
- //result1 = "insert into test(feature,lat,lan) values(ST_GeomFromText('"+feature+"),"+lat+","+lan+"')";
- //result1 = "insert into test(feature) values(ST_GeomFromText('POINT("+lat+" "+lan+")', 4326))";
- result1 = "insert into test(feature) values(ST_GeomFromText('"+feature+"("+lat+" "+lan+")'))";
- sql.executeUpdate(result1);
- out.println("data inserted...");
- String nextJSP = "/index.jsp";
- RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
- dispatcher.forward(request,response);
- out.println("forwarding...");
- //System.out.println(fst);
- }
- catch(SQLException | ClassNotFoundException e)
- {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement