MySQL PreparedStatement Error
Hi all. Thanks for previous assistance. I am trying to select from MySQL using a PreparedStatement, however I keep getting the error below. I have included the code from JSP and my Java. When I run the Select statement from a command window it works properly and retrieves the proper information (when I replace the ? with the value from add_confirm.jsp prefix_var). I really appreciate any help.
Gary
*** utility.java ***
public ResultSet getPrefix(int util_prefix) throws SQLException, Exception {
ResultSet rs = null;
try {
PreparedStatement getPre;
getPre = con.prepareStatement (
"select a.util_id, a.util_abbr, a.util_name, b.util_db_id from pre_util a, power_source b where a.util_id = b.util_db_id AND b.util_db_id = ? ;");
getPre.setInt(1, util_prefix);
getPre.execute();
} catch (SQLException e) {
error = "SQLException: get failed" + e.getMessage();
throw new SQLException(error);
} catch (Exception e) {
error = "Exception: An exception occurred while getting utility";
throw new Exception(error);
return rs;
*** add_confirm.jsp ***
<jsp:useBean id="utility" class="com.yb.util.user.utility" />
int prefix_var = Integer.parseInt(request.getParameter("prefix"));
out.println(prefix_var); // the value is being passed correctly
utility.getPrefix((int) prefix_var);
ResultSet rs = utility.getPrefix();
while (rs.next()) {
String prefix_st = "";
prefix_st = rs.getString("a.util_abbr");
*** My Error ***
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\jsp\add_005fconfirm_jsp.java:92: getPrefix(int) in com.yb.util.user.utilitycannot be applied to ()
ResultSet rs = utility.getPrefix();
_______________^
utility.getPrefix((int) prefix_var);
ResultSet rs = utility.getPrefix();
You're calling your method twice, the second time without a parameter.
Try
ResultSet rs = utility.getPrefix(prefix_var); (no cast should be necessary)
Similar Messages
-
MySQL problem -- ERROR 2002 Can't connect to local MySQL server
Not Sure if this would be a right forum for my problem...
I'm installing mySQL on my iBook, and thought that I have configured it. But then, after followring some instuctions from Adobe and Marc Liyanage sites, I have a problem to connect. This is what I've done in "TERMINAL"
~username$> cd /usr/local/mysql
mysql ~username$> sudo chown -R mysql data/
(asking for admin password)
mysql ~username$> sudo echo
mysql ~username$> sudo ./bin/mysqld_safe &
username-ibook-g4:/usr/local/mysql username$ Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/roshaili-osmans-ibook-g4.local.pid
060611 16:31:30 mysqld ended
mysql ~username> /usr/local/mysql/bin/mysql test
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[1]+ Done sudo ./bin/mysqld_safe
mysql ~username>
When I typed ::
/usr/local/mysql/bin/mysqladmin -u root
(see that there's no password)
Then it displays:
/usr/local/mysql/bin/mysqladmin Ver 8.41 Distrib 5.0.22, for apple-darwin8.6.0 on powerpc
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Administration program for the mysqld daemon.
Usage: /usr/local/mysql/bin/mysqladmin [OPTIONS] command command....
-c, --count=# Number of iterations to make. This works with -i
(--sleep) only.
...... bla bla bla.....
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
count 0
force FALSE
compress FALSE
character-sets-dir (No default value)
default-character-set (No default value)
host (No default value)
port 0
.........bla bla....
ping Check if mysqld is alive
processlist Show list of active threads in server
reload Reload grant tables
refresh Flush all tables and close and open logfiles
shutdown Take server down
status Gives a short status message from the server
start-slave Start slave
stop-slave Stop slave
variables Prints variables available
version Get version info from server
roshaili-osmans-ibook-g4:~ roshailiosman$ >
-----------------finish-----------------
Does that mean that I'm connected to mySQL?
Does anybody how to connect to MYSQL from the terminal? Thanks.
iMac Mac OS X (10.4.6)
iMac Mac OS X (10.4.6)Your biggest 'issue' right now is that your mysqld process is stopping on you -- making a connection impossible.
Why it's bombing might be in a log .. try in mysql/data/usr.local.err .. and fix why itsbombing.
To connect to it it'll be : mysql -u root -ppassword -D database -
Postgres/mysql PreparedStatement not working
Hi All,
I am encountering errors when using a "?" in PrepareStatement.
like PrepareStatment pstmt = conn.prepareStatement(update table set col1 = ?")
this only occurs for posrgresql and mysql. is there a fix for this?
ThanksWhat exactly is your problem. It can't be that using a ? is the problem, because the ? is what makes a PreparedStatement a PreparedStatement. So what, exactly, is the problem. The code snippet containing a full PreparedStatement construction, parameter setting, and execution along with any errors/exceptions/"unexpected results" will be needed to solve your problem.
P.S. I hope that code segment you provided was hand typed and not copied because you are missing the " at the beginning of the SQL. -
Dg4odbc to MySQL update errors: "does not support IS NULL in this context"
I am having a problem with 'where x is null' clauses in update statements to MySQL from 11g, using dg4odbc. Updates using the clause 'where x is null' return errors like this:
ORA-02070: database PLAZAHOST does not support IS NULL in this context
The rejected queries never get to mysql. Furthermore, I noticed that select statements with 'where x is null' show up in the mysql query log with the where clause stripped out, although correct results are returned to SQLPlus. It looks as though 'where x is null' is stripped off by dg4odbc, which subsequently applies a secondary filter to the results received from MySQL.
Note, both statements above work properly when issued from the MySQL client.
Has anybody seen this? It's a big problem for me, but I can't find any references to other people having the same problem, so I assume I've got something misconfigured -- but I don't know what.
I'm using MySQL ODBC 5.1 Driver, MySQL 5.1 Community Edition, and Oracle 11g R1 all running on a 32-bit Windows server.
Thank you -- rick
=============
here's a spool of a sample oracle session:
SQL> col descr1 for a40
SQL> select * from t1@plazahost;
id1 descr1
1 hello
2
SQL> descr t1@plazahost
Name Null? Type
id1 NUMBER(10)
descr1 VARCHAR2(255)
SQL> select * from t1@plazahost where "descr1" is null;
id1 descr1
2
SQL> update t1@plazahost set "descr1"='updated' where "descr1" is null;
update t1@plazahost set "descr1"='updated' where "descr1" is null
ERROR at line 1:
ORA-02070: database PLAZAHOST does not support IS NULL in this context
SQL> spool off
=============
here's the mysql query log snip for the oracle session:
100804 10:24:20 1637 Connect moms_oracle@MOMS_HOST on moms
1637 Query SET NAMES utf8
1637 Query SET character_set_results = NULL
1637 Query SET SQL_AUTO_IS_NULL = 0
1637 Query set autocommit=0
1637 Query select database()
1637 Query COMMIT
1637 Query SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
1637 Query SHOW TABLE STATUS FROM `moms` LIKE 'T1'
1637 Query SHOW COLUMNS FROM `moms`.`t1`
1637 Query SELECT `id1`,`descr1` FROM `moms`.`t1` LIMIT 0
1637 Query SHOW KEYS FROM `moms`.`T1`
1637 Query SHOW TABLE STATUS FROM `moms` LIKE 'T1'
1637 Query SHOW COLUMNS FROM `moms`.`t1`
1637 Query SELECT `id1`,`descr1` FROM `moms`.`t1` LIMIT 0
1637 Query SELECT A1.`id1`,A1.`descr1` FROM `T1` A1
1637 Query SELECT `id1`,`descr1` FROM `T1`
100804 10:24:28 1637 Query COMMIT
1637 Quit
=============
here's the Oracle HS trace file for the same oracle session:
Oracle Corporation --- WEDNESDAY AUG 04 2010 10:24:19.608
Heterogeneous Agent Release
11.1.0.7.0
Oracle Corporation --- WEDNESDAY AUG 04 2010 10:24:19.608
Version 11.1.0.7.0
Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "DEBUG"
Entered hgosdip
setting HS_OPEN_CURSORS to default of 50
setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
setting HS_FDS_RECOVERY_PWD to default value
setting HS_FDS_TRANSACTION_LOG to default of "HS_TRANSACTION_LOG"
setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
setting HS_NLS_NCHAR to default of "UCS2"
setting HS_FDS_TIMESTAMP_AS_DATE to default of "TRUE"
setting HS_RPC_FETCH_REBLOCKING to default of "ON"
setting HS_FDS_FETCH_ROWS to default of "100"
setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
setting HS_FDS_MAP_NCHAR to default of "TRUE"
setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
setting HS_FDS_QUERY_DRIVER to default of "TRUE"
setting HS_FDS_SUPPORT_STATISTICS to default of "TRUE"
Parameter HS_FDS_QUOTE_IDENTIFIER is not set
setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics"
Exiting hgosdip, rc=0
ORACLE_SID is "plazahost"
Product-Info:
Port Rls/Upd:7/0 PrdStat:0
Agent:Oracle Database Gateway for ODBC
Facility:hsa
Class:ODBC, ClassVsn:11.1.0.7.0_0006, Instance:plazahost
Exiting hgogprd, rc=0
Entered hgoinit
HOCXU_COMP_CSET=1
HOCXU_DRV_CSET=178
HOCXU_DRV_NCHAR=1000
HOCXU_DB_CSET=178
HOCXU_SEM_VER=110000
Entered hgolofn at 2010/08/04-10:24:19
Exiting hgolofn, rc=0 at 2010/08/04-10:24:20
HOSGIP for "HS_OPEN_CURSORS" returned "50"
HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
Exiting hgoinit, rc=0 at 2010/08/04-10:24:20
Entered hgolgon at 2010/08/04-10:24:20
reco:0, name:moms_oracle, tflag:0
Entered hgosuec at 2010/08/04-10:24:20
Exiting hgosuec, rc=0 at 2010/08/04-10:24:20
HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
HOSGIP for "HS_FDS_TRANSACTION_LOG" returned ""HS_TRANSACTION_LOG""
HOSGIP for "HS_FDS_TIMESTAMP_AS_DATE" returned "TRUE"
HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
HOSGIP for "HS_FDS_RESULT_SET_SUPPORT" returned "FALSE"
HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
using moms_oracle as default value for "HS_FDS_DEFAULT_OWNER"
HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
Entered hgocont at 2010/08/04-10:24:20
HS_FDS_CONNECT_INFO = "momsPlazaHost"
RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
Entered hgogenconstr at 2010/08/04-10:24:20
dsn:momsPlazaHost, name:moms_oracle
optn:
##>Connect Parameters (len=43)<##
## DSN=momsPlazaHost;
#! UID=moms_oracle;
#! PWD=*
Exiting hgogenconstr, rc=0 at 2010/08/04-10:24:20
DriverName:myodbc5.dll, DriverVer:05.01.0005
DBMS Name:MySQL, DBMS Version:5.1.35-community-log
Exiting hgocont, rc=0 at 2010/08/04-10:24:20
SQLGetInfo returns Y for SQL_CATALOG_NAME
SQLGetInfo returns 64 for SQL_MAX_CATALOG_NAME_LEN
Exiting hgolgon, rc=0 at 2010/08/04-10:24:20
Entered hgoulcp at 2010/08/04-10:24:20
Entered hgowlst at 2010/08/04-10:24:20
Exiting hgowlst, rc=0 at 2010/08/04-10:24:20
SQLGetInfo returns ` for SQL_IDENTIFIER_QUOTE_CHAR
SQLGetInfo returns Y for SQL_COLUMN_ALIAS
2 instance capabilities will be uploaded
capno:1991, context:0x0001ffff, add-info: 0
capno:1992, context:0x0001ffff, add-info: 1, translation:"`"
Exiting hgoulcp, rc=0 at 2010/08/04-10:24:20
Entered hgouldt at 2010/08/04-10:24:20
0 instance DD translations were uploaded
Exiting hgouldt, rc=0 at 2010/08/04-10:24:20
Entered hgobegn at 2010/08/04-10:24:20
tflag:0 , initial:1
hoi:0x12f03c, ttid (len 26) is ...
00: 4D4F4D53 44422E38 62393537 3032392E [MOMSDB.8b957029.]
10: 322E3130 2E333131 3531 [2.10.31151]
tbid (len 23) is ...
00: 4D4F4D53 44425B32 2E31302E 33313135 [MOMSDB[2.10.3115]
10: 315D5B31 2E345D [1][1.4]]
TXN Capable:3, Isolation Option:0xf
Exiting hgobegn, rc=0 at 2010/08/04-10:24:20
Entered hgodtab at 2010/08/04-10:24:20
count:1
table: T1
Entered hgopcda at 2010/08/04-10:24:20
Column:1(id1): dtype:4 (INTEGER), prc/scl:10/0, nullbl:1, octet:0, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/08/04-10:24:20
Entered hgopcda at 2010/08/04-10:24:20
Column:2(descr1): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:1, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/08/04-10:24:20
The hoada for table T1 follows...
hgodtab, line 651: Printing hoada @ 02A32DDC
MAX:2, ACTUAL:2, BRC:1, WHT=6 (TABLE_DESCRIBE)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
4 INTEGER Y 4 4 0/ 0 0 0 0 id1
12 VARCHAR Y 255 255 0/ 0 0 0 0 descr1
Exiting hgodtab, rc=0 at 2010/08/04-10:24:20
Entered hgodafr, cursor id 0 at 2010/08/04-10:24:20
Exiting hgodafr, rc=0 at 2010/08/04-10:24:20
Entered hgotcis at 2010/08/04-10:24:20
Calling SQLStatistics for T1
Calling SQLColumns for moms_oracle.T1
Column "id1": dtype=4, colsize=10, decdig=0, char_octet_length=0, cumulative avg row len=4
Column "descr1": dtype=12, colsize=255, decdig=0, char_octet_length=255, cumulative avg row len=195
Exiting hgotcis, rc=0 at 2010/08/04-10:24:20
Entered hgopars, cursor id 1 at 2010/08/04-10:24:20
type:0
SQL text from hgopars, id=1, len=40 ...
00: 53454C45 43542041 312E6069 6431602C [SELECT A1.`id1`,]
10: 41312E60 64657363 72316020 46524F4D [A1.`descr1` FROM]
20: 20605431 60204131 [ `T1` A1]
Exiting hgopars, rc=0 at 2010/08/04-10:24:20
Entered hgoopen, cursor id 1 at 2010/08/04-10:24:20
hgoopen, line 83: NO hoada to print
Exiting hgoopen, rc=0 at 2010/08/04-10:24:20
Entered hgodscr, cursor id 1 at 2010/08/04-10:24:20
Entered hgopcda at 2010/08/04-10:24:20
Column:1(id1): dtype:4 (INTEGER), prc/scl:10/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/08/04-10:24:20
Entered hgopcda at 2010/08/04-10:24:20
Column:2(descr1): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:1, octet:256, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/08/04-10:24:20
hgodscr, line 506: Printing hoada @ 02A32DDC
MAX:2, ACTUAL:2, BRC:100, WHT=5 (SELECT_LIST)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
4 INTEGER Y 4 4 0/ 0 0 0 0 id1
12 VARCHAR Y 256 256 0/ 0 0 0 0 descr1
Exiting hgodscr, rc=0 at 2010/08/04-10:24:21
Entered hgoftch, cursor id 1 at 2010/08/04-10:24:21
hgoftch, line 117: Printing hoada @ 02A32DDC
MAX:2, ACTUAL:2, BRC:100, WHT=5 (SELECT_LIST)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
4 INTEGER Y 4 4 0/ 0 0 0 0 id1
12 VARCHAR Y 256 256 0/ 0 0 0 0 descr1
SQLBindCol: column 1, cdatatype: -16, bflsz: 4
SQLBindCol: column 2, cdatatype: 1, bflsz: 257
2 rows fetched
Exiting hgoftch, rc=0 at 2010/08/04-10:24:21
Entered hgoftch, cursor id 1 at 2010/08/04-10:24:21
hgoftch, line 117: Printing hoada @ 02A32DDC
MAX:2, ACTUAL:2, BRC:2, WHT=5 (SELECT_LIST)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
4 INTEGER Y 4 4 0/ 0 0 0 0 id1
12 VARCHAR Y 5 256 0/ 0 0 0 0 descr1
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/08/04-10:24:21
Entered hgoclse, cursor id 1 at 2010/08/04-10:24:23
Exiting hgoclse, rc=0 at 2010/08/04-10:24:23
Entered hgodafr, cursor id 1 at 2010/08/04-10:24:23
Exiting hgodafr, rc=0 at 2010/08/04-10:24:23
Entered hgopars, cursor id 1 at 2010/08/04-10:24:23
type:0
SQL text from hgopars, id=1, len=31 ...
00: 53454C45 43542060 69643160 2C606465 [SELECT `id1`,`de]
10: 73637231 60204652 4F4D2060 543160 [scr1` FROM `T1`]
Exiting hgopars, rc=0 at 2010/08/04-10:24:23
Entered hgoopen, cursor id 1 at 2010/08/04-10:24:23
hgoopen, line 83: NO hoada to print
Exiting hgoopen, rc=0 at 2010/08/04-10:24:23
Entered hgodscr, cursor id 1 at 2010/08/04-10:24:23
Entered hgopcda at 2010/08/04-10:24:23
Column:1(id1): dtype:4 (INTEGER), prc/scl:10/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/08/04-10:24:23
Entered hgopcda at 2010/08/04-10:24:23
Column:2(descr1): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:1, octet:256, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/08/04-10:24:23
hgodscr, line 506: Printing hoada @ 02A32DDC
MAX:2, ACTUAL:2, BRC:100, WHT=5 (SELECT_LIST)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
4 INTEGER Y 4 4 0/ 0 0 0 0 id1
12 VARCHAR Y 256 256 0/ 0 0 0 0 descr1
Exiting hgodscr, rc=0 at 2010/08/04-10:24:24
Entered hgoftch, cursor id 1 at 2010/08/04-10:24:24
hgoftch, line 117: Printing hoada @ 02A32DDC
MAX:2, ACTUAL:2, BRC:100, WHT=5 (SELECT_LIST)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
4 INTEGER Y 4 4 0/ 0 0 0 0 id1
12 VARCHAR Y 256 256 0/ 0 0 0 0 descr1
SQLBindCol: column 1, cdatatype: -16, bflsz: 4
SQLBindCol: column 2, cdatatype: 1, bflsz: 257
2 rows fetched
Exiting hgoftch, rc=0 at 2010/08/04-10:24:24
Entered hgoftch, cursor id 1 at 2010/08/04-10:24:24
hgoftch, line 117: Printing hoada @ 02A32DDC
MAX:2, ACTUAL:2, BRC:2, WHT=5 (SELECT_LIST)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
4 INTEGER Y 4 4 0/ 0 0 0 0 id1
12 VARCHAR Y 5 256 0/ 0 0 0 0 descr1
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/08/04-10:24:24
Entered hgoclse, cursor id 1 at 2010/08/04-10:24:27
Exiting hgoclse, rc=0 at 2010/08/04-10:24:27
Entered hgodafr, cursor id 1 at 2010/08/04-10:24:27
Exiting hgodafr, rc=0 at 2010/08/04-10:24:27
Entered hgocomm at 2010/08/04-10:24:28
keepinfo:0, tflag:1
00: 4D4F4D53 44422E38 62393537 3032392E [MOMSDB.8b957029.]
10: 322E3130 2E333131 3531 [2.10.31151]
tbid (len 23) is ...
00: 4D4F4D53 44425B32 2E31302E 33313135 [MOMSDB[2.10.3115]
10: 315D5B31 2E345D [1][1.4]]
cmt(0):
Entered hgocpctx at 2010/08/04-10:24:28
Exiting hgocpctx, rc=0 at 2010/08/04-10:24:28
Exiting hgocomm, rc=0 at 2010/08/04-10:24:28
Entered hgolgof at 2010/08/04-10:24:28
tflag:1
Exiting hgolgof, rc=0 at 2010/08/04-10:24:28
Entered hgoexit at 2010/08/04-10:24:28
Exiting hgoexit, rc=0 at 2010/08/04-10:24:28is null statement is post processed. This means in case of a select ALL records from the remote database are fetched into the Oracle database and the is null statement is then processed locally in the Oracle db.
So thze select will work as it is handled internally in the Oracle database. This also means as But "is null" isn't sent to the foreign MySQL db the update clause will fail with ORA-02070: database PLAZAHOST does not support IS NULL in this context
You need to recode the statement or use passthrough statements. -
Can't connect PHP/MySQL 404 error
Wow, the learning curve is killing me. Yet another challenge. I'm using Dreamweaver CC and this tutorial http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html
I'm at this step:
Open comments.php. You must have a PHP page open in the Document window to create a MySQL connection.
In the Databases panel (choose Window > Databases), click the Plus button on the panel and select MySQL Connection.The MySQL Connection dialog box appears.
Type connTest as the connection name.
For the MySQL Server, type localhost.If you are using the MAMP default ports on a Mac, use localhost:8889.
For the User Name, type phptestuser.
Type the password you chose for the phptestuser account in the Password field.
For the Database, type php_test.Note: You don't need to precede the underscore with a backslash here. It was inserted by phpMyAdmin in the previous section (see Figure 20) only because phpMyAdmin uses a query that permits wildcard characters.
Click Test.Dreamweaver attempts to connect to the database. If the connection fails, do the following:
Double-check the server name, user name, and password.
Check the settings for the folder Dreamweaver uses to process dynamic pages (see Specifying a Testing Server for Dreamweaver).
Verify that the web and MySQL servers are both running.
Temporarily disable any firewall or security program. If the connection works, you need to configure the security program to permit communication between Dreamweaver and MySQL.
Click OK. The new connection appears in the Databases panel.
Expand the connTest connection, and then expand the Tables branch. You'll see the comments table in the database, which you can expand to reveal the details of the table columns (see Figure 23).
As far as I can tell I have followed this tutorial to the letter.
As far as I can tell, XAMPP/php mySQL are all running fine, the files are in the correct place and everything should be working. However when I hit test I get a 404 error. (Same error when I hit the select button.)
The suggested problems on the 404 message are:
1. There is no testing server running on the server machine.
Pretty sure the testing server is running. Is there any way to test this, other than to note that xampp is definitely running right now and that I can log into phpMYadmin no problem?
2. The testing server specified for this site does not map to the http://localhost/php_test/_MMServerScripts/MMHTTPDB.php URL Verify that the URL Prefix maps to the root of the site.
Ummm...I'm pretty sure I put things where I was told to put them in the tutorial, but I'm lost at this point where I should verify what. A clue here? The files are where they are supposed to be, but maybe I entered something wrong? Except...I'm not sure what that could be or where to find it. Whatever IT is.
Everything in local files is looking good.
Thanks for your help!
PS: Extra points to anyone who figures out how to make copy/pasteable error messages! These buggers are the bane of my life!Bgupta, you rock!
I hope you have copied the "mysql.php" and "MMHTTPDB.php" files from "C:\Users\username\AppData\Roaming\Adobe\Dreamweaver CC\locale\Configuration\Connections\Scripts\PHP_MySQL\_mmDBScripts" to "C:\xampp\htdocs\phptest\_mmServerScripts"
This was EXACTLY the problem. I checked the tutorial and I couldn't even find where the tutorial said to do this. (If I missed it, let me know where in the tutorial it was, please.)
Fixed! -
I am getting this back:
TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at AS3_Flash_Poll_PHP_MySQL_fla::WholePoll_1/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
PHP code:
<?php
// ---------------------------------------- Section 1 -----------------------------------------------
// IMPORTANT!!!! Connect to MySQL database here(put your connection data here)
mysql_connect("ginaty05.fatcowmysql.com","fall2010","@regina") or die (mysql_error());
mysql_select_db("poll_2010") or die (mysql_error());
// When Flash requests the totals initially we run this code
if ($_POST['myRequest'] == "load_numbers") {
// Query the totals from the database
$sql1 = mysql_query("SELECT id FROM votingPoll WHERE choice='1'");
$choice1Count = mysql_num_rows($sql1);
$sql2 = mysql_query("SELECT id FROM votingPoll WHERE choice='2'");
$choice2Count = mysql_num_rows($sql2);
$sql3 = mysql_query("SELECT id FROM votingPoll WHERE choice='3'");
$choice3Count = mysql_num_rows($sql3);
echo "choice1Count=$choice1Count";
echo "&choice2Count=$choice2Count";
echo "&choice3Count=$choice3Count";
// ---------------------------------------- Section 2 -----------------------------------------------
// IF POSTING A USER'S CHOICE
if ($_POST['myRequest'] == "store_choice") {
//Obtain user IP address
$ip = $_SERVER['REMOTE_ADDR'];
// Create local variable from the Flash ActionScript posted variable
$userChoice = $_POST['userChoice'];
$sql = mysql_query("SELECT id FROM votingPoll WHERE ipaddress='$ip'");
$rowCount = mysql_num_rows($sql);
if ($rowCount == 1) {
$my_msg = "You have already voted in this poll.";
print "return_msg=$my_msg";
} else {
$sql_insert = mysql_query("INSERT INTO votingPoll (choice, ipaddress) VALUES('$userChoice','$ip')") or die (mysql_error());
$sql1 = mysql_query("SELECT * FROM votingPoll WHERE choice='1'");
$choice1Count = mysql_num_rows($sql1);
$sql2 = mysql_query("SELECT * FROM votingPoll WHERE choice='2'");
$choice2Count = mysql_num_rows($sql2);
$sql3 = mysql_query("SELECT * FROM votingPoll WHERE choice='3'");
$choice3Count = mysql_num_rows($sql3);
$my_msg = "Thanks for voting!";
echo "return_msg=$my_msg";
echo "&choice1Count=$choice1Count";
echo "&choice2Count=$choice2Count";
echo "&choice3Count=$choice3Count";
?>
AS3 code:
stop(); // Stop the timeline since it does not need to travel for this to run
// Assign a variable name for our URLVariables object
var variables1:URLVariables = new URLVariables();
// Build the varSend variable
var varSend1:URLRequest = new URLRequest("parse_my_poll.php");
varSend1.method = URLRequestMethod.POST;
varSend1.data = variables1;
// Build the varLoader variable
var varLoader1:URLLoader = new URLLoader;
varLoader1.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader1.addEventListener(Event.COMPLETE, completeHandler1);
// Set variable to send to PHP here for the varloader below
variables1.myRequest = "load_numbers";
// Send data to php file now, and wait for response using the COMPLETE event
varLoader1.load(varSend1);
function completeHandler1(event:Event):void{
count1_txt.text = "" + event.target.data.choice1Count;
count2_txt.text = "" + event.target.data.choice2Count;
count3_txt.text = "" + event.target.data.choice3Count;
// hide the little processing movieclip
processing_mc.visible = false;
// Initialize the choiceNum variable that we will use below
var choiceNum:Number = 0;
// Set text formatting colors for errors and success messages
var errorsFormat:TextFormat = new TextFormat();
errorsFormat.color = 0xFF0000; // bright red
var successFormat:TextFormat = new TextFormat();
successFormat.color = 0x00FF00; // bright green
// Button Click Functions
function btn1Click(event:MouseEvent):void{
choiceNum = 1;
choice_txt.text = choice1_txt.text;
function btn2Click(event:MouseEvent):void{
choiceNum = 2;
choice_txt.text = choice2_txt.text;
function btn3Click(event:MouseEvent):void{
choiceNum = 3;
choice_txt.text = choice3_txt.text;
// Button Click Listeners
btn1.addEventListener(MouseEvent.CLICK, btn1Click);
btn2.addEventListener(MouseEvent.CLICK, btn2Click);
btn3.addEventListener(MouseEvent.CLICK, btn3Click);
// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();
// Build the varSend variable
var varSend:URLRequest = new URLRequest("parse_my_poll.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
// Handler for PHP script completion and return
function completeHandler(event:Event):void{
// remove processing movieclip
processing_mc.visible = false;
// Clear the form fields
choice_txt.text = "";
choiceNum = 0;
// Load the response from the PHP file
status_txt.text = event.target.data.return_msg;
status_txt.setTextFormat(errorsFormat);
if (event.target.data.return_msg == "Thanks for voting!") {
// Reload new values into the count texts only if we get a proper response and new values
status_txt.setTextFormat(successFormat);
count1_txt.text = "" + event.target.data.choice1Count;
count2_txt.text = "" + event.target.data.choice2Count;
count3_txt.text = "" + event.target.data.choice3Count;
// Add an event listener for the submit button and what function to run
vote_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
// Validate form fields and send the variables when submit button is clicked
function ValidateAndSend(event:MouseEvent):void {
//validate form fields
if(!choice_txt.length) {
// if they forgot to choose before pressing the vote button
status_txt.text = "Please choose before you press vote.";
status_txt.setTextFormat(errorsFormat);
} else {
status_txt.text = "Sending...";
processing_mc.visible = true;
// Ready the variables for sending
variables.userChoice = choiceNum;
variables.myRequest = "store_choice";
// Send the data to the php file
varLoader.load(varSend);
} // close else after form validation
} // Close ValidateAndSend function ////////////////////////This error means that you are trying to set the text field but there is no data in the variable. As a first step, try to identify where this is happening, eg Is it the first call, or once you have submitted your data or only if you try to submit data second time?
Trace out the data that is returned for both completeHandlers to see if there is a missing var. Try this for "load_numbers" and "store_choice". Do it twice for "store_choice". Do you get back what you expected?
You could also try altering the php to return some fixed dummy variables, eg choice1Count=11&choice2Count=22&choice3Count=33, etc. If this works then you know that the error is in the PHP.
It looks to me like the issue is when you submit the data a second time and just get back the return_msg - the handler then tries to assign the choice1Count etc but doesn't have any count data back from the poll.php.
Test that there is data before assigning it, eg
if(event.target.data.choice1Count){
count1_txt.text = event.target.data.choice1Count;
count2_txt.text = event.target.data.choice2Count;
count3_txt.text = event.target.data.choice3Count; -
HELP!!, MySQL JDBC ERROR!!, Please Help!!
I'm excecuting this JSP code, to connect to a MySQL Database on the same server as my JSP containter, but i keep getting this error when it excecutes the ResultSet's getString() method. I Can't find the mistake anywhere so if anybody can help me i would really apreciate it!!!
TANX!!! :)
Here's the message i get:
ERROR CODE:0 , SQLSTATUS:S1000, MESSAGE: "before start of result set ".
Here's the code i'm excecuting:
String nombreBDD = "tesis";
String nombreServidor = "localhost";
int portnumber = 3306;
String username = "root";
String password = "backhoff";
int flag = 0; //Bandera para no tener dos etiquetas XML raiz
String no_telefono = null;
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
MysqlDataSource mysql = new MysqlDataSource();
mysql.setDatabaseName(nombreBDD);
mysql.setServerName(nombreServidor);
mysql.setPortNumber(portnumber);
try
conn = mysql.getConnection(username, password);
}catch(SQLException e)
String sqlState = e.getSQLState();
Integer i = new Integer(e.getErrorCode());
String errorCode = i.toString();
String message = e.getMessage();
flag = 1;
out.println("Error:" + errorCode + " Mensaje: " + message + " Estado SQL:" + sqlState);
e = null;
try
stmt = conn.createStatement();
}catch(SQLException e)
String sqlState = e.getSQLState();
Integer i = new Integer(e.getErrorCode());
String errorCode = i.toString();
String message = e.getMessage();
out.println("Error:" + errorCode + " Mensaje: " + message + " Estado SQL:" + sqlState);
e = null;
try
rs = stmt.executeQuery("SELECT * FROM alumnos");
}catch(SQLException e)
String sqlState = e.getSQLState();
Integer i = new Integer(e.getErrorCode());
String errorCode = i.toString();
String message = e.getMessage();
out.println("Error:" + errorCode + " Mensaje: " + message + " Estado SQL:" + sqlState);
e = null;
try
no_telefono = rs.getString(1); // Here's where i get the error !!!!!
}catch(SQLException e)
String sqlState = e.getSQLState();
Integer i = new Integer(e.getErrorCode());
String errorCode = i.toString();
String message = e.getMessage();
out.println("Error:" + errorCode + " Mensaje: " + message + " Estado SQL:" + sqlState);
e = null;
}You have to loop over your result set with something like
while(rs.next()){
String str = rs.getString(1);
/*add str to a data structure, such as an ArrayList if your query returns more then a record
}Luigi -
Connection mysql jdbc error ?
I have program java likes this :
import java.sql.*;
public class LoadDriver {
// Define the JDBC Driver and the database connection URL
public static final String DRIVER = "com.mysql.jdbc.Driver";
public static final String URL = "jdbc:mysql://localhost/java?user=test&password=test";
public static void main(String args[]) {
Connection conn = null;
Statement select = null;
ResultSet result = null;
try {
// load the driver dynamically
Class.forName(DRIVER);
// connect to the database
conn = DriverManager.getConnection(URL);
// perform a query. first create a Statement object from the connection
select = conn.createStatement();
// next execute a query (SQL string) and return the results in a ResultSet object
result = select.executeQuery("select fname, lname from names order by lname, fname");
// print out the results
while(result.next()) {
String fname = result.getString("fname"); // note these match the columns in the
String lname = result.getString("lname"); // SELECT statement (fname, lname)
System.out.println(fname+" "+lname);
// check if there was a problem executing the SQL statement
catch (SQLException e) {
System.err.println("SQL Exception: "+e.getMessage());
System.exit(1);
// if the JDBC driver is not in the CLASSPATH
catch (ClassNotFoundException e) {
System.err.println("Class not found: "+e.getMessage());
System.exit(1);
// catch any other exceptions
catch (Exception e) {
System.err.println("Other Exception: ");
System.err.println(e.getMessage());
System.exit(1);
// You want to close the connections no matter what happens!
finally {
try {
// close the result, query, and database connection
if (result != null) result.close();
if (select != null) select.close();
if (conn != null) conn.close();
catch (SQLException e) {
// one of the new cases where it's OK to just eat exceptions or at the most log them
System.err.println("Error closing connection: "+e.getMessage());
but i get errror likes this :
D:\Program Files\Java\jdk1.5.0_03\bin>javac LoadDriver.java
D:\Program Files\Java\jdk1.5.0_03\bin>java LoadDriver
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Sign
ature
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at LoadDriver.main(LoadDriver.java:20)
D:\Program Files\Java\jdk1.5.0_03\bin>
I place mysql.jar in
- D:\Program Files\Java\jdk1.5.0_03\jre\lib\ext
- D:\Program Files\Java\jdk1.5.0_03\lib
- D:\Program Files\Java\jdk1.5.0_03\jre\lib
and i make classpath to D:\Program Files\Java\jdk1.5.0_03\bin;D:\Program Files\Java\jdk1.5.0_03\jre\lib\ext\
but it still doesn't work
What must I do ?
Thx 4 your replyHello!
I'm getting this same error message and i followed the code example as close as i could:
Thanks for any help on this!
bk
set oldpath=%PATH%
set JAVA_HOME=C:\jdk1.5.0_02
set ANT_HOME=C:\ANT\apache-ant-1.6.5
set PATH=C:\jdk1.5.0_02\bin;%ANT_HOME%\bin
set CLASSPATH=.;C:\jdk1.5.0_02\lib;C:\MYSQL\mysql-connector-java-3.1.10\src\com\;C:\MYSQL\mysql-connector-java-3.1.10\src\org\;C:\MYSQL\mysql-connector-java-3.1.10\mysql-connector-java-3.1.10-bin-g.jar;
http://www.developer.com/java/data/article.php/3417381#Critical_steps_in_using_JDBC
import java.sql.*;
public class Jdbc11 {
public static void main(String args[]){
System.out.println(
"Copyright 2004, R.G.Baldwin");
try {
Statement stmt;
//Register the JDBC driver for MySQL.
Class.forName("com.mysql.jdbc.Driver");
//Define URL of database server for
// database named mysql on the localhost
// with the default port number 3306.
String url =
"jdbc:mysql://localhost:3306/mysql";
//Get a connection to the database for a
// user named root with a blank password.
// This user is the default administrator
// having full privileges to do anything.
Connection con =
DriverManager.getConnection(
url,"root", "");
//Display URL and connection information
System.out.println("URL: " + url);
System.out.println("Connection: " + con);
//Get a Statement object
stmt = con.createStatement();
//Create the new database
stmt.executeUpdate(
"CREATE DATABASE JunkDB");
//Register a new user named auser on the
// database named JunkDB with a password
// drowssap enabling several different
// privileges.
stmt.executeUpdate(
"GRANT SELECT,INSERT,UPDATE,DELETE," +
"CREATE,DROP " +
"ON JunkDB.* TO 'auser'@'localhost' " +
"IDENTIFIED BY 'drowssap';");
con.close();
}catch( Exception e ) {
e.printStackTrace();
}//end catch
}//end main
}//end class Jdbc11
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature -
ODBC - Oracle to MySQL - Syntex Error Generated!
Dear All,
Finally I am able to connect to MySQL from Oracle Database using ODBC connector.
Database is 11gR1 on Linux and MySQL is 5.1 in Windows.
I can connect MySQL using database link.
I can describe tables and view using command desc abc_a@bssdata structure of mysql table is displayed
BUT when i try to select columns or select * from tables it is giving the following error:
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[MySQL][ODBC 3.51 Driver][mysqld-5.1.30-community-log]You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server version for
the right syntax to use near '"EMPLOYEE_ID" FROM "BSSDATA"."ABC_A" A1' at line
1
ORA-02063: preceding 2 lines from BSSDATA
Can you please help me in getting out of this error.
Regards,
ImranThere's a much better forum for this kind of questions:
Heterogeneous Connectivity
Werner -
MySQL Sytax error with master and detail pages
Master and Detail pages.
I get an SQL error when I click on an Item in the Master
page.
“You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax
to use near 'ID = 16 LIMIT 0, 10' at line 1 “
If I try to open the detail page I get
“You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax
to use near 'ID = -1 LIMIT 0, 10' at line 1 “
I created this pair by simply clicking on Insert/data object/
master detail page.
I have tried this various ways, but always get the same
result.
Is there a bug in CS3?Sorry I have solved it myself.
I had accidentally put a space in a table header in the mySQL
data bank.
All works well now. -
I'm getting this error when i try submitting values from my Jsp page into a database:
Method preparedStatement(java.lang.String)not found in interface java.sql.Connection.
The arrow that appears usually beneath the code in the error 500 message suggests that the problem is occuring in the insert statement, and im thinking it does'nt like the question mark in place of the value.
Is this because im importing the wrong class? my current class string is:
@page contentType="text/html; charset=iso-8859-1" language="java" import="java.lang.string.*" import="java.sql.*"
This is what the line within the program looks like:-
quote = Connquote.preparedStatement("INSERT INTO table1(A, B, C, D, E, F, G, H, I, J, K, L, M, N) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )");But this gives me an error:
java.sql.SQLException:Parameter index out of range (1
number of parameters, w
If it says that it means you don't have any bind variables in your SQL.
Whah happens obj is null?Nothing to do with it. And you are writing code that is probably pointless as well. setObject() handles nulls. -
Hi
I'm using CS4 DW with all the updates. I can log onto my local mysql database but when I setup for the one on my remote webserver
I get the following error
MySql Error 2000
mysqlind cannot connect to MYSQL4.1 using old authentication
This seems to be a standard error, is there a fix or am I missing something?
thanks
Ianhello sir, am isaac from u
ganda i also wanted to upload an im
ge in mysql database but i failed until igot on your tutorial about
Upload images to a MySQL database (PHP)
and i tried to use it but it seems i wasnet connecting to the server please help and correct this Error. for now am using "localhost" where i need to specify the "pass" and "User" but i don't understand this systax you used here
please help me
<?php define ('MAX_FILE_SIZE', 1024 * 50); ?>
<?php require_once('Connections/testConn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "uploadImage")) {
// make sure it's a genuine file upload
if (is_uploaded_file($_FILES['image']['tmp_name'])) {
// replace any spaces in original filename with underscores
$filename = str_replace(' ', '_', $_FILES['image']['name']);
// get the MIME type
$mimetype = $_FILES['image']['type'];
if ($mimetype == 'image/pjpeg') {
$mimetype= 'image/jpeg';
// create an array of permitted MIME types
$permitted = array('image/gif', 'image/jpeg', 'image/png');
// upload if file is OK
if (in_array($mimetype, $permitted)
&& $_FILES['image']['size'] > 0
&& $_FILES['image']['size'] <= MAX_FILE_SIZE) {
switch ($_FILES['image']['error']) {
case 0:
// get the file contents
$image = file_get_contents($_FILES['image']['tmp_name']);
// get the width and height
$size = getimagesize($_FILES['image']['tmp_name']);
$width = $size[0];
$height = $size[1];
$insertSQL = sprintf("INSERT INTO iimages (filename, mimetype, caption, image, width, height) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($filename, "text"),
GetSQLValueString($mimetype, "text"),
GetSQLValueString($_POST['caption'], "text"),
GetSQLValueString($image, "text"),
GetSQLValueString($width, "int"),
GetSQLValueString($height, "int"));
mysql_select_db($database_name, $db_name);
$Result1 = mysql_query($insertSQL, $db_name) or die(mysql_error());
if ($Result1) {
$result = "$filename uploaded successfully.";
} else {
$result = "Error uploading $filename. Please try again.";
break;
case 3:
case 6:
case 7:
case 8:
$result = "Error uploading $filename. Please try again.";
break;
case 4:
$result = "You didn't select a file to be uploaded.";
} else {
$result = "$filename is either too big or not an image.";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>File upload to database</title>
</head>
<body>
<?php
// if the form has been submitted, display result
if (isset($result)) {
echo "<p><strong>$result</strong></p>";
?>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="uploadImage" id="uploadImage">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo MAX_FILE_SIZE; ?>" />
<label for="image">Upload image:</label>
<input type="file" name="image" id="image" />
</p>
<p>
<label for="caption">Caption:</label>
<input type="text" name="caption" id="caption" />
</p>
<p>
<input type="submit" name="upload" id="upload" value="Upload" />
</p>
<input type="hidden" name="MM_insert" value="uploadImage" />
</form>
</body>
</html> -
Hi all,
The query is "SELECT * FROM tblPages t WHERE t.SiteID=1000 AND t.DisplayModule = 'on' and t.Deleted = 'N' order by t.navorder"
When i execute the above query using JDBC i get the following Exception:
java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY t.navorder' at line 1"
but when i execute the same query at the command prompt it works without any problem.
I am using MySQL 4.1 database
Please help,
Seshuhere's my code:
query = "SELECT * FROM tblPages t WHERE t.SiteID=1000
AND t.DisplayModule = 'on' and t.Deleted = 'N' and
t.NavParent = 21 order by t.navorder";
try {
rs = db.getResults(query);
} catch (Exception e2) {
System.out.println("<<<<<<<<< Exception in
FIRSTTTTT");
e2.printStackTrace();
}wrong try again...
i know that is the not the code that produced the error above... you have a different case for BY for starters...
try and post your actual code and not what you WISH you were doing. -
Hi!
I´m Trying to load the mysql connector into oracle database.
I create a package to connect to mysql and all that is missing is the jdbc driver.
So i executed loadjava, but i´m getting the error bellow. Can anyone help me?
Oracle database 10g
arguments: '-u' 'vendas/***@idev10g' '-v' '-resolve' '/ora10g/app/oracle/product/10.2.0/db_1/jlib/mysql-connector-java-5.1.12.jar'
dropped : JAVA$CLASS$MD5$TABLE
Exception in thread "main" java.lang.UnsatisfiedLinkError: getClassContext
at com.ibm.jvm.classloader.ClassLoaderUtils.getLastClassLoader(ClassLoaderUtils.java:38)
at java.security.Provider.loadProvider(Provider.java:209)
at java.security.Security$2.run(Security.java:434)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java:351)
at java.security.Security.getProviderAt(Security.java:431)
at java.security.Security.getAlgClassName(Security.java:583)
at java.security.Security.getAlgClassName(Security.java:637)
at java.security.Security.getImpl(Security.java:1118)
at java.security.MessageDigest.getInstance(MessageDigest.java:135)
at oracle.aurora.server.tools.loadjava.SchemaObject.MD5OfStream(SchemaObject.java:730)
at oracle.aurora.server.tools.loadjava.SchemaObject.getNewMD5(SchemaObject.java:418)
at oracle.aurora.server.tools.loadjava.SchemaObject.doCreate(SchemaObject.java:174)
at oracle.aurora.server.tools.loadjava.SchemaObject.process1(SchemaObject.java:215)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:548)
at oracle.aurora.server.tools.loadjava.LoadJava.addObject(LoadJava.java:529)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:467)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:396)
at oracle.aurora.server.tools.loadjava.LoadJava.addJar(LoadJava.java:743)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:448)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:396)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:365)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:668)
at oracle.aurora.server.tools.loadjava.LoadJava.processDeferredFiles(LoadJava.java:633)
at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:834)
at oracle.aurora.server.tools.loadjava.LoadJava.command(LoadJava.java:267)
at oracle.aurora.server.tools.loadjava.LoadJavaMain.run(LoadJavaMain.java:164)
at oracle.aurora.server.tools.loadjava.LoadJavaMain.main(LoadJavaMain.java:89)I solved it.
I had to increase the java pool memory (first time i run the server complained about it) and then load the mysql jdbc driver executing in sqlplus:
dbms_java.loadjava('path to jdbc driver file');
When executing from console, the loadjava command require extra information (LD_LIBRARY_PATH etc) giving the error i mention above.
Executing from sqlplus it is all set. -
SELECT DISTINCT in MySQL gives error...
Anyone help with this one - I'm sure it's easy.
I have a working bean for a jsp where the statement sent to the QUERY is >> private String "SELECT * FROM mytablename ORDER BY afieldname <<. It works fine and there's no overt problems. But I dont want to return all the >> hasNext in the resultSet rs << To see the working example of why, log in at www.klaatu2u.com and go to the "ballets" menu item.
I'm trying to modify the query string to
private String "SELECT DISTINCT afieldname FROM mytablename ORDER BY afieldname " << and it's giving me a column index out of range error 3 > 1 error. As far as I can tell this comes from the resultset class in the see here below//error i keep getting...from mysql/jdbc2/
// if (columnIndex < 1 || columnIndex > Fields.length) {
// throw new java.sql.SQLException("Column Index out of range ( " + columnIndex + " > " + Fields.length + ").", "S1002");
At any rate it is erroring on my mod'd query string. No clue as to why it wont see the column index properly. I have tried "SELECT DISTINCT afieldname FROM tablename WHERE afieldname = '*' " and it doesnt give the error, just no resultset.
I'm using NETBEANS for my compiler :-/ , and mysql connector-j. I'm doing a lot of other fun stuff with it (stringtokenizing data for SPEED!) and all works well - just the DISTINCT myfieldname is no-go.
No I'm not to smart - but could sure use help anyway. Thanx much for anyone who responds...thanks for the incredible ZERO replies and suggestions - anyhow it's fixed .
Maybe you are looking for
-
How to draw a specific size circle?
I have to make a 7cm diameter in a homework i'm doing in pages, but i can't find a way to make it in this specific size. Can someone tell me the way? Thanks, Mateo
-
Content in iTunes Media folder is not loaded on new Computer
1. Yesterday I moved my iTunes Media folder from Computer A to a external HD. Used the instructions found here and everything works/worked great. I removed my old iTunes Media folder and verified that Computer A was indeed super happy and e.g. found
-
How to prevent changes to SOLD TO in sales order
Hi, Can someone remind how to stop users from changinf the address of the SOLD TO in a sales order? We allow users to change the SHIP TO address but sometimes they select the wrong partner and update the SOLD TO and then the delivery is made to the w
-
Have a macbook 4.1 software version osx 10.5.8 is this os leopard?
trying to find out if the osx v 10.5.8 can be upgraded to a newer os and how?
-
My screen on my iPhone 5 is broken, somebody please help!
I really need somebody's help, the scene on my iPhone has gone blank and stopped working. I can tell that my phone is on because when I flip the volume switch it'll vibrate, me when I screen shot or change it, it'll make a sound. Also when I have the