I have the query below: $insert2query="INSERT INTO output_search(ref_code, title, author, channel_id) VALUES (select refcode,title, authors, $idquery as cid from chemoJ where title LIKE '%$search%' and refcode NOT IN (select exc_refid_fk FROM exclusions))"; It is giving me an error near the parenthesis, what is wrong with my sintax? I ran the different pieces of the query individually so I could see if the expected results were being returned, and it seems fine. But when I put them all together, it doesn't work. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

Hi All First post. PHP/PostgreSQL newbie... I'm trying to create a simple web page with a dropdown menu. The values for the dropdown menu are retrieved from a database table. The code I've got is... <html> <body> <select> <?php $db = pg_connect("host=hostname port=5432 dbname=dbname user=user password=password") or die ("Could not connect to DB"); $sql = pg_query(sprintf("SELECT hostname FROM pkgchk")); while ($row = pg_fetch_assoc($sql)) { echo "<option value=$row[hostname]>$row[hostname]</option>"; } pg_close($db); ?> </select> </body> </html> I've racked my brain and done a lot of googling, and I can't understand what's wrong. I suspect the DB connection is not working. However, if I …

Member Avatar
Member Avatar
+0 forum 2

I made this code: INSERT into author(authorfirstname1, authorlastname1,authorfirstname2, authorlastname2) select '".addslashes($_POST['authorfirstname1'])."','".addslashes($_POST['authorlastname1'])."','".addslashes($_POST['authorfirstname2'])."','".addslashes($_POST['authorlastname2'])."' from author where not exists(select authorfirstname1, authorlastname1, authorfirstname2, authorlastname2 from author where author.authorfirstname1='".addslashes($_POST['authorfirstname1'])."' and author.authorlastname1='".addslashes($_POST['authorlastname1'])."' and author.authorfirstname2='".addslashes($_POST['authorfirstname2'])."' and author.authorlastname2='".addslashes($_POST['authorlastname2'])."' ); The point of this code should be that it checks, if a value allready exists in database and if it doesnt, then it enters it. This '".addslashes($_POST['authorlastname2'])."' represents an input, but could easyly be replaced with '%myentereddata%' My problem is that it doesnt do anything...doesnt even give error message, its success, but it doesnt enter data if data doesnt exist in db allready and not sure if it stops …

Member Avatar
Member Avatar
+0 forum 1

Good day I’m new with JSP, here the problem, I just converting the code from SQL to PostgreSQL, but a problem occur after I change to DataSource ds = (DataSource)envCtx.lookup( "jdbc/postgres" ); and add a scheme to the query. By theory it should be ok but it produce this error Error accessing StudPractical bean. java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Vector the code vResult = beanPractical.viewSchoolListing(limit, start, searchState, searchKey, searchBy, schoolType, rosID, sem); Practical Class public Vector viewSchoolListing(int paramInt1, int paramInt2, String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6) { Statement localStatement = null; ResultSet localResultSet …

Member Avatar
Member Avatar
+0 forum 1

Hi, I am in urgent need for converting sql procedure to postgre sql procedure.Please help me ASAP. CREATE FUNCTION sp_get_id_des (IN cellid INT, IN mcc VARCHAR(3), IN mnc VARCHAR(3), IN nwtype INT, IN mlac INT , IN mrac INT ) returns SETOF record AS' declare pscnt int ; declare cscnt int; declare cnt1 int ; declare cnt2 int; declare cscnid int ; declare pscni int; declare cscnpoolid varchar(20); declare pscnpoolid varchar(20); **DECLARE CONTINUE HANDLER FOR SQLSTATE '42S02' SET @x2 = 1;** BEGIN drop table TEMP_CNINFO_TBL; drop table RESULT_TBL; create temporary table TEMP_CNINFO_TBL select * from FGW_DBS_CNINFO_TBL where CNINFO_MLAC=mlac and CNINFO_MRAC=mrac …

Member Avatar
+0 forum 0

I am developing an sql query to use to grab information from a postgres db. The scenario is as follows: the database I am grabbing information is the backend postgres database of an application (Tableau). My objective is to pull all of the workbooks, views, and datasources (considered objects) that are untagged in the database. I am using 4 tables - taggings (contains all tagged objects related to the object by the objects id), views (contains all views and their ids), workbooks (contains all workbooks and their ids), and datasources (contains all datasources and their ids). I have already successfully …

Member Avatar
Member Avatar
+0 forum 7

Hello friends, I am working an a section of application which needs to Parse CSV Logs generated by PostgreSql server. - The Logs are stored C:\Program Files\PostgreSQL\9.0\data\pg_log - The Server version in 9.0.4 - The application is developed in C Sharp * The basic utility after Parse the Log is to show contents in a DataGridView. * There are other filter options like to view log contents for a particular range of Time for a Day. **However the main problem that is, the Log format is not readable** It was first tested with A Fast CSV Reader - http://stackoverflow.com/questions/2081418/parsing-csv-files-in-c-sharp - …

Member Avatar
Member Avatar
+0 forum 8

I'm trying to connect a DB from Postgres with a program in Java. I'm including this code: Class.forName(driver); Connection con = DriverManager.getConnection(connectString, user , password); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM students"); But I'm getting this erros in Statemen and stmt.excuteQuery: With Statement: *incompatible types. Required: java.beans.Statement. Found: java.sql.Statement* With .executeQuery: *Cannot find symbol. Symbol: method executeQuery (java.lang.String). Location: class java.beans.Statement* In all the tutorials they include this code and they don't seem to have any problem. Any idea what can I do?

Member Avatar
Member Avatar
+0 forum 3

I have run into an interesting problem. I have inherited a database for daemon process that polls and accepts reports from remote embedded systems. Each site that has one of these systems can monitor over a dozen different fuel tanks. (In practice, most monitor 2, 3 or 4 tanks.) When something happens, such as a tank being refilled or a tank reaching a minimum level, the program saved that event in a Postgres database. The way the database was originally constructed, it was saving all the information from each fuel tank (type of fuel, etc.) in the event record, even …

Member Avatar
Member Avatar
+0 forum 2

am trying to connect a jsp page to a postgress database i have created a jdbcconnects.java file and compiled it with jsp_api.jar from my apache..../lib directory i have placed the class file in root/WEB-INF/classes folder the code of my class file is [CODE] import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Jdbcconnections { public Connection connect()throws Exception { Connection con = null; try { Class.forName ("org.postgresql.Driver"); con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/EMPPWD", "postgres", "ankur"); } catch(Exception e) { System.err.println("Exception: " + e.getMessage());} return con; } } [/CODE] in the jsp page i have written [CODE] <%@ page import="Jdbcconnections" %> Jdbcconnections obj=new Jdbcconnections(); Connection …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I was wondering if any of you have had any experience with Catalyst and Moose. I am starting a project that I think would use both. I plan to use mod_perl or fast_cgi with Catalyst as the framework and Mason as the template language (I have used Mason quite a bit, it's kind of a JSP or ASP version of perl). If any of you have experience in these technologies, I'd love to hear for you. I need to configure these technologies and work on the MVC architecture. Mason = view, Catalyst = controller and Model will be …

Member Avatar
+0 forum 0

The End.