Connecting mysql
Hi,
How can i connect my iphone app to mysql database and perform the opertaions like udate ,delete etc
First you get a JDBC driver for MySQL. (Their home page will refer you to some.) Then you look in the documentation that comes with that driver; it has examples.
Similar Messages
-
Dear All,
from couple of days I am trying to connect mysql from my oracle database.
I have studied so many documentations and have created one of my own. I am just struck at one point.
My oracle database is 11gR1 and CentOS 5.1 32-bit is the operating system.
MySQL is on a windows based machine and version is 5.1.
What I can do:
I can connect MySQL from Linux using the command: isql –v bssdata <user> <password> [Connected]
I can tnsping the listener using command: tnsping bssdata [OK]
But after setting up what i did in the documentation below when I try to connect mysql using a DB link. It gives the following error:
select * from bssdata.sta_mis_std_marks@bssdata
Error at Command Line:1 Column:40
Error report:
SQL Error: ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
ORA-02063: preceding line from BSSDATA
28500. 00000 - "connection from ORACLE to a non-Oracle system returned this message:"
*Cause: The cause is explained in the forwarded message.
*Action: See the non-Oracle system's documentation of the forwarded
message.
Please help me get out of this. Thank you very much
Here are the details what i did:
Install required packages
Yum install mysql-connector-odbc
Yum install unixODBC
vi /etc/odbc.ini
[bssdata]
# myodbc3 = MySQL ODBC 3.51 Driver DSN
# [myodbc3]
Driver = /usr/lib/libmyodbc3.so
Description = MySQL ODBC 3.51 Driver DSN
SERVER = 192.168.0.68
PORT = 3306
USER = ******
Password = ******
Database = bssdata
OPTION = 3
SOCKET =
vi /etc/odbcinst.ini
# Example driver definitinions
# Included in the unixODBC package
#[PostgreSQL]
#Description = ODBC for PostgreSQL
#Driver = /usr/lib/libodbcpsql.so
#Setup = /usr/lib/libodbcpsqlS.so
#FileUsage = 1
# Driver from the MyODBC package
# Setup from the unixODBC package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc3.so
Setup = /usr/lib/libodbcmyS.so
FileUsage = 1
Test Connection
isql –v bssdata ****** ******
Editing listener.ora file to add entry
# listener.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = blissglb.abc.edu.pk)(PORT = 1521))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
(PROGRAM = extproc)
(SID_DESC =
(PROGRAM = dg4odbc)
(ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
(SID_NAME = bssdata)
(ENVS=LD_LIBRARY_PATH = /usr/local/lib:/u01/app/oracle/product/11.1.0/db_1/odbc)
Restart listener
Lsnrctl> stop
Lsnrctl> start
Test listener
tnsping bssdata
Editing tnsnames.ora file in network directory of oracle
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
BLISSGLB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = blissglb.abc.pk)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = blissglb.abc.edu.pk)
BSSGLB, BSSGLB.abc.EDU.PK =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.24)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bssglb.abc.edu.pk)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = IPC)
(KEY = EXTPROC1521)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
bssdata =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.66)(PORT = 1521))
(CONNECT_DATA =
(SID = bssdata)
(HS = OK)
Edit Oracle’s bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_HOME
ORACLE_SID=blissglb
export ORACLE_SID
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
LD_LIBRARY_PATH=/usr/local/lib:/u01/app/oracle/product/11.1.0/db_1/lib
export LD_LIBRARY_PATH
ODBCINI=/etc/odbc.ini
export ODBCINI
ODBCSYSINI=/etc
export ODBCSYSINI
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
unset USERNAME
Configure file db_1/hs/admin/inithsodbc.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
#HS_FDS_CONNECT_INFO = <odbc data_source_name>
#HS_FDS_TRACE_LEVEL = <trace_level>
#HS_FDS_SHAREABLE_NAME = <full path name of odbc driver manager or driver>
HS_FDS_CONNECT_INFO = bssdata
HS_FDS_TRACE_LEVEL = off
HS_FDS_SHAREABLE_NAME = /usr/lib/libmyodbc3.so
# ODBC specific environment variables
#set ODBCINI=<full path name of the odbc initilization file>
set ODBCINI=/etc/odbc.ini
# Environment variables required for the non-Oracle system
set <envvar>=<value>
Create Database Link
Create database link bssdata connect to ****** identified by ******** using ‘bssdata’
Using selection query
Select * from bssdata.sta_mis_std_marks@bssdata {Here comes the error described above}
Regards,
ImranHi ,
i am facing the same issue.
These are my findings at this moment.
By looking at http://www.pythian.com/news/1554/how-to-access-mysql-from-oracle-with-odbc-and-sql/ we can see that :
"Connector ODBC 5.1. The Oracle Gateway for ODBC checks/relies on some features, such as the ODBC descriptor, that are not available in 3.51. You can check the associated documentation and bug 32692 for some details about SQLSetDescRec"
So we have a bug related to SQLSetDescRec missing from the libmyodbc3.so library.
We can check this as follows :
[oracle@log]$ nm -D /usr/lib64/libmyodbc3.so | fgrep SQLMoreResults
0000000000017c70 T SQLMoreResults
[oracle@log]$ nm -D /usr/lib64/libmyodbc3.so | fgrep SQLSetEnvAttr
0000000000016c40 T SQLSetEnvAttr
[oracle@log]$ nm -D /usr/lib64/libmyodbc3.so | fgrep SQLSetDescRec
No output for SQLSetDescRec.
Now i have to see how can i get over this bug.
Regards,
George -
ORA-28500 and ORA-02063 while connecting MySQL from Oracle-
Dear All,
My Database is Oracle 11gR2 Rac of 2 nodes and on Linux 64-Bit operating system.
Version of my MySQL database is 5.5.17 it is on Linux 32-Bit operating system.
I am trying to connect MySQL database from Oracle database using a database link.
These are the step by step process that I am following to achieve my target. All my processes are on one node of Oracle RAC.
1)
Yum install mysql-connector-odbc
Yum install unixODBC
2)
Edit file /etc/odbc.ini
[test]
Driver = /usr/lib64/libmyodbc3.so
Description = MySQL ODBC 3.51 Driver DSN
SERVER = 10.0.0.1
PORT = 3306
USER = test
Password = test
Database = test
OPTION = 3
SOCKET =
3)
Edit file /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib64/libmyodbc3.so
Setup = /usr/lib64/libodbcmyS.so
FileUsage = 1
4) test connection
isql –v test test test
Returns:
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
SQL>
5) Now I edit listener.ora file and add the entry. After entry my listener.ora file is like this:
LISTENER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
(ADDRESS = (PROTOCOL = TCP)(HOST=testnode1)(PORT = 1521))
# line added by Agent
LISTENER_SCAN1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER_SCAN1))
# line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1 = ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON # line added by Agent
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
(SID_DESC =
(PROGRAM = dg4odbc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = test)
(ENVS=LD_LIBRARY_PATH = /usr/local/lib:/u01/app/oracle/product/11.2.0/dbhome_1/lib)
6) After these entries the listener status after RESTART is as following:
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 27-DEC-2011 01:19:32
Uptime 0 days 9 hr. 31 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/racnode1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=testnode1)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "test" has 1 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Service "testdb" has 1 instance(s).
Instance "testdb1", status READY, has 1 handler(s) for this service...
Service "racdbXDB" has 1 instance(s).
Instance "testdb1", status READY, has 1 handler(s) for this service...
The command completed successfully
7) Then in the tnsnames.ora file I added the following entry:
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = IPC)
(KEY = EXTPROC1521)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
test =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SID = test)
(HS = OK)
When i tnsping test, it works.
8) I edit the .bash_profile file for Oracle
ORACLE_HOME, ORACLE_BASE were already pointing to the correct destination, I added:
LD_LIBRARY_PATH=/usr/local/lib:/u01/app/oracle/product/11.1.0/db_1/lib:/u01/app/oracle/product/11.2.0/dbhome_1/hs/lib:/usr/lib64:/usr/lib
export LD_LIBRARY_PATH
ODBCINI=/etc/odbc.ini
export ODBCINI
ODBCINSTINI=/etc/odbc.ini
export ODBCINSTINI
ODBCSYSINI=/etc
export ODBCSYSINI
9) Then i configured $ORACLE_HOME/hs/admin/inithsodbc.ora
And Modified these lines:
HS_FDS_CONNECT_INFO = test
HS_FDS_TRACE_LEVEL = ON
HS_FDS_TRACE_FILE_NAME = odbc_test.log
HS_FDS_TRACE_LEVEL = 4
HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so
HS_FDS_SUPPORT_STATISCTICS = FALSE
HS_LANGUAGE = AMERICAN_AMERICA.WE8ISO8859P1
set ODBCINI = /etc/odbc.ini
10) Then i created a database link with the following command:
Create public database link test connect to test identified by test using ‘test’;
I tried username and password in database link with double quotes also.
11) Now Finally when I try to select records from mysql table:
select count(*) from "table"@"test"; -- I have tried with and without double quotes
I get the following error:
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
ORA-02063: preceding line from TEST
How to get through this error, and how to check logs for HS?
Your help is required.
Regards, Imran
Edited by: misterimran on Dec 27, 2011 1:21 PMHi,
In your listener.ora for the DG4ODBC entry you had -
(ENVS=LD_LIBRARY_PATH = /usr/local/lib:/u01/app/oracle/product/11.2.0/dbhome_1/lib)
but this should also include the path for the driver manager directory which in your case is /usr/lib64 so could you add this ?
The error -
Failed to load ODBC library symbol: /usr/lib64/libmyodbc3.so(SQLSetDescRec)
indicates the /usr/lib64 directory cannot be accessed.
The entry should then look like -
(SID_DESC =
<space>(PROGRAM = dg4odbc)
<space>(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
<space>(SID_NAME = test)
<space>(ENVS=LD_LIBRARY_PATH = /usr/local/lib:/usr/lib64:/u01/app/oracle/product/11.2.0/dbhome_1/lib)
<space>)
The spaces may have bene lost when posting but there should be at least one space in the file as indicated by the <space>.
After making the change then stop and start the listener.
If you still have problems then please post again the current versions of the configuration files, the full errors shown in SQLPLUS for a select and the output from a debug trace showing the errors.
The information shows you are using the 3.51 MySQL ODBC driver so could you also try with the latest version of the 5.1 driver and see if you have the same problem ?
Regards,
Mike -
How to connect mysql to my palm devices?
hi, need help on how to connect mysql to my palm devices? is there anyone know to do connect mysql to palm devices using wireless toolkit?
thanksMidlet:
os.writeUTF(db.trim());
os.writeUTF("\r\n");
os.writeUTF(user.trim());
os.writeUTF("\r\n");
os.writeUTF(pwd.trim());Servlet:
String db = in.readLine();
String user = in.readLine();
String pwd = in.readLine();If it works, that's just luck, but it's completely wron.! Why? Read the api doc's of DataOutputStream! -
How to connect mysql database using xml
welcome to all,
here my doubt is how to connect mysql database using xml file, how to integrate xml file and jsp file and how to access data from dabase using jsp file. can any one help me
regardsShort answer: you wouldn't do any of those things. The first two are meaningless and the third is a bad practice. I have no idea what those ideas were supposed to achieve so I have no idea what tutorials I should suggest to you.
-
How to Connect MySQL Database Through JTable?
Hi,
How to Connect MySQL Database Through JTable? anyone of u knows these concept please send me coding of that Part..
Thanks,
Guru..Start by reading the tutorials. There's a section on Swing which shows you how to use tables and a section on JDBC which shows you how to use SQL.
And you can always search the forum as well since there are working examples of both posted on the forum.
If you need further help with a specific problem then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting. -
How to connect mySQL database with jdbc
Who can tell me how to connect mySQL database with jdbc? Thanks
http://onesearch.sun.com/search/developers/index.jsp?and=connect+mysql&nh=10&phr=&qt=¬=&field=title&since=&col=devforums&rf=0&Search.x=24&Search.y=16
-
How to connect MySql database with JSP
Dear everyone,
how to connect MySql database with JSP......It's too bad that nobody has ever asked this question before...
-
How to connect Mysql to J2EE server exactly?
Hi,there
I would like thank you for offering me your precious opinion in advance.
I got a problem with installing Mysql database into J2EE server. All I have done is:
1.Install Mysql and put the Mysql driver,mm.mysql-2.0.4-bin.jar into the directory of J2EE which is j2ee1.3.1/lib.
2. Set the environment variable for invoking the Mysql driver like
this,CLASSPATH=.;%JAVA_HOME%\lib\mysql-connector-java-2.0.14-bin;%
J2EE_HOME%\lib\mysql-connector-java-2.0.14-bin;%JAVA_HOME%\bin;
3.Modify the content of Server.xml file located in J2EE directory like this:
<DefaultContext>
<Resource name="jdbc/mysql" auth="Container"
type="javax.sql.DataSource" />
<ResourceParams name="jdbc/mysql">
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>drivername</name>
<value>jdbc:mysql:localhost:3306:mobiledb</value>
</parameter>
</ResourceParams>
</DefaultContext>
So far,I have no success in connect Mysql to J2EE server. What am I doing wrong?
Thank you for your kind help.hi, sameer
Thank you for reply. Could you tell me exactly the documents that you see? Do you mean "J2EE tutorial documents"?
Thanks for advice.
Revon -
Connect MySQL to Coldfusion MX 7
Hi,
When I try to connect MySQL to Coldfusion MX 7, I get the
following message:
"Connection verification failed for data source:
ColdFusion_conncn
java.sql.SQLException: Communication failure during
handshake. Is there a server running on localhost:3306?
The root cause was that: java.sql.SQLException: Communication
failure during handshake. Is there a server running on
localhost:3306?"
Is this because I downloaded MySQL via apache2Triad that came
with bunch of stuff including apache and MySQL.
What are the steps I have to take to ensure that the
connection with MySQL works fine?
Thanks for the help.
Khttp://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6ef0253
-
Connect Mysql in Flex Using VB
Hai All,
Could any one tell me how to connect Mysql in flex using vb. I tried, but i am getting the below error.How to import mysql class.
Compiler Error Message: BC30002: Type 'MySql.Data.MySqlClient.MySqlConnection' is not defined.
Source Error:
Line 5:
Line 6: Public Class Database
Line 7: Public DBConnection As MySql.Data.MySqlClient.MySqlConnection
Line 8:
Line 9: Public Function DBNAME() As String
And i want to convert the text to voice, how to do this?? Any idea .. please help me
Thanks and Regards,
Arun KumarSystem.err.println("Exception: " + e.getMessage());You should do something more useful instead, like e.printStackTrace(). THe message of an exception doesn't always say very much.
You are probably getting a "class not found exception" signaling that the class com.mysql.jdbc.Driver cannot be found --- you need to somehow make JCreator aware of the JDBC driver. -
Please help me to connect MySQL with Oracle developer 2000.
i try to make a servlet which make the connection with
mysql by jdbc. the compilation is good but when i
execute i have :
[root@ classes]# java FoncConnexion
java.lang.NoSuchMethodError: main
at
at
at
t
java.lang.Throwable.fillInStackTrace(Throwable.java:nat
ve)
at
at java.lang.Throwable.<init>(Throwable.java:38)
at java.lang.Error.<init>(Error.java:21)
at
at
at
t java.lang.LinkageError.<init>(LinkageError.java:21)
at
at
at
t
java.lang.IncompatibleClassChangeError.<init>(Incompati
leClassChangeError.java:21)
at
at
at
t
java.lang.NoSuchMethodError.<init>(NoSuchMethodError.ja
a:21)
What does it mean?
what can i do?
ThanksIt means there is no main() method in your class. If you want to execute it, u have to create a main method first. -
Is there a demo regarding VS2013 to connect mysql? thanks in advanced.
Hi david,
Unless your question is about the microsoft scheduling and planning online application, you are on the wrong forum.
That being said, here are some post that might help you:
http://stackoverflow.com/questions/18578785/mysql-database-connection-with-visual-studio-2013-preview
https://cdn.mysql.com/Downloads/MySQLInstaller/mysql-visualstudio-plugin-1.1.1.msi
Hope this helps,
Guillaume Rouyre, MBA, MCP, MCTS | -
Connect Mysql And Eclipse c++
i trying to connect mysql database and eclipse c++ and i set everything but when i want to compile a program using data base this error massage appears:
"fatal error:boost/shared_ptr.hpp: no such file or directory"
how can i fix it, there is no solution on the internet, and i really really really tired of searching about this.
my compiler: gcc
my os: windows 8.1
here you can see my code:
#include <stdlib.h>
#include <iostream>
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
using namespace std;
int main(void)
cout << endl;
cout << "Let's have MySQL count from 10 to 1..." << endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *pstmt;
/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "37975");
/* Connect to the MySQL test database */
con->setSchema("test");
stmt = con->createStatement();
stmt->execute("DROP TABLE IF EXISTS test");
stmt->execute("CREATE TABLE test(id INT)");
delete stmt;
/* '?' is the supported placeholder syntax */
pstmt = con->prepareStatement("INSERT INTO test(id) VALUES (?)");
for (int i = 1; i <= 10; i++) {
pstmt->setInt(1, i);
pstmt->executeUpdate();
delete pstmt;
/* Select in ascending order */
pstmt = con->prepareStatement("SELECT id FROM test ORDER BY id ASC");
res = pstmt->executeQuery();
/* Fetch in reverse = descending order! */
res->afterLast();
while (res->previous())
cout << "\t... MySQL counts: " << res->getInt("id") << endl;
delete res;
delete pstmt;
delete con;
} catch (sql::SQLException &e) {
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line "
<< __LINE__ << endl;
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() <<
" )" << endl;
cout << endl;
return EXIT_SUCCESS;It's not clear if you understand my question.
Will you do me the favor of looking at your screen and tell me if there is a simple in front of any of the includes? Do you have a question mark "?" or any other error indicating that it can't find the include?
Thanks!
-- L. James
L. D. James
[email protected]
www.apollo3.com/~ljames
Danial Atash wrote on Fri, 07 August 2015 08:12my mySQL path is: "D:\Programs\Programming\MySQL\MySQL Server 5.5"
and my mysql-connector c++ path that i download it from mysql's website is: "D:\Programs\Programming\MySQL\Connector C++"
and my-boost library that i don't know what is it is: "D:\Programs\Programming\boost_1_57_0"
i go to the eclipse and select the Project>>properties>>c/c++ build>>GCC C++ Comiler>>Includes and add below Item to Include path:
- "D:\Programs\Programming\MySQL\Connector C++\include"
- "D:\Programs\Programming\MySQL\MySQL Server 5.5\include"
- "D:\Programs\Programming\boost_1_57_0\boost"
and then i go to the Project>>properties>>c/c++ build>>MINGW C++ Linker>> Libraries and add below items to library search path:
- "D:\Programs\Programming\MySQL\MySQL Server 5.5\lib"
- "D:\Programs\Programming\MySQL\Connector C++\lib"
now when i want to compile this program(from mysql example )
#include <stdlib.h>
#include <iostream>
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
using namespace std;
int main(void)
cout << endl;
cout << "Let's have MySQL count from 10 to 1..." << endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *pstmt;
/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "37975");
/* Connect to the MySQL test database */
con->setSchema("test");
stmt = con->createStatement();
stmt->execute("DROP TABLE IF EXISTS test");
stmt->execute("CREATE TABLE test(id INT)");
delete stmt;
/* '?' is the supported placeholder syntax */
pstmt = con->prepareStatement("INSERT INTO test(id) VALUES (?)");
for (int i = 1; i <= 10; i++) {
pstmt->setInt(1, i);
pstmt->executeUpdate();
delete pstmt;
/* Select in ascending order */
pstmt = con->prepareStatement("SELECT id FROM test ORDER BY id ASC");
res = pstmt->executeQuery();
/* Fetch in reverse = descending order! */
res->afterLast();
while (res->previous())
cout << "\t... MySQL counts: " << res->getInt("id") << endl;
delete res;
delete pstmt;
delete con;
} catch (sql::SQLException &e) {
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line "
<< __LINE__ << endl;
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() <<
" )" << endl;
cout << endl;
return EXIT_SUCCESS;
i see it is dont compile and i see these errors:
- Description Resource Path Location Type
fatal error: boost/shared_ptr.hpp: No such file or directory Working line 31, external location: D:\Programs\Programming\MySQL\Connector C++\include\mysql_connection.h C/C++ Problem
i don't know why i cant connect mysql to eclipse. i tried to connect it more and more (at least 1 month)
Please Help me!!!! -
How to connect mysql and oracle 10g by UTL_HTTP?
how to connect mysql 5.0 and oracle 10g r2 by UTL_HTTP?what to do for this url connection exactly?
cant i change anything to stup a link?
SQL> desc utl_http
PROCEDURE ADD_COOKIES
Argument Name Type In/Out Default?
COOKIES TABLE OF RECORD IN
FUNCTION BEGIN_REQUEST RETURNS RECORD
Argument Name Type In/Out Default?
URL VARCHAR2(32767) OUT
METHOD VARCHAR2(64) OUT
HTTP_VERSION VARCHAR2(64) OUT
PRIVATE_HNDL BINARY_INTEGER OUT
URL VARCHAR2 IN
METHOD VARCHAR2 IN DEFAULT
HTTP_VERSION VARCHAR2 IN DEFAULT
PROCEDURE CLEAR_COOKIES
PROCEDURE CLOSE_PERSISTENT_CONN
Argument Name Type In/Out Default?
CONN RECORD IN
HOST VARCHAR2(256) IN
PORT BINARY_INTEGER IN
PROXY_HOST VARCHAR2(256) IN
PROXY_PORT BINARY_INTEGER IN
SSL BOOLEAN IN
PROCEDURE CLOSE_PERSISTENT_CONNS
Argument Name Type In/Out Default?
HOST VARCHAR2 IN DEFAULT
PORT BINARY_INTEGER IN DEFAULT
PROXY_HOST VARCHAR2 IN DEFAULT
PROXY_PORT BINARY_INTEGER IN DEFAULT
SSL BOOLEAN IN DEFAULT
PROCEDURE END_REQUEST
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
PROCEDURE END_RESPONSE
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
PROCEDURE GET_AUTHENTICATION
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
SCHEME VARCHAR2 OUT
REALM VARCHAR2 OUT
FOR_PROXY BOOLEAN IN DEFAULT
PROCEDURE GET_BODY_CHARSET
Argument Name Type In/Out Default?
CHARSET VARCHAR2 OUT
FUNCTION GET_BODY_CHARSET RETURNS VARCHAR2
PROCEDURE GET_COOKIES
Argument Name Type In/Out Default?
COOKIES TABLE OF RECORD IN/OUT
FUNCTION GET_COOKIE_COUNT RETURNS BINARY_INTEGER
PROCEDURE GET_COOKIE_SUPPORT
Argument Name Type In/Out Default?
ENABLE BOOLEAN OUT
MAX_COOKIES BINARY_INTEGER OUT
MAX_COOKIES_PER_SITE BINARY_INTEGER OUT
PROCEDURE GET_DETAILED_EXCP_SUPPORT
Argument Name Type In/Out Default?
ENABLE BOOLEAN OUT
FUNCTION GET_DETAILED_SQLCODE RETURNS BINARY_INTEGER
FUNCTION GET_DETAILED_SQLERRM RETURNS VARCHAR2
PROCEDURE GET_FOLLOW_REDIRECT
Argument Name Type In/Out Default?
MAX_REDIRECTS BINARY_INTEGER OUT
PROCEDURE GET_HEADER
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
N BINARY_INTEGER IN
NAME VARCHAR2 OUT
VALUE VARCHAR2 OUT
PROCEDURE GET_HEADER_BY_NAME
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
NAME VARCHAR2 IN
VALUE VARCHAR2 OUT
N BINARY_INTEGER IN DEFAULT
FUNCTION GET_HEADER_COUNT RETURNS BINARY_INTEGER
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
PROCEDURE GET_PERSISTENT_CONNS
Argument Name Type In/Out Default?
CONNECTIONS TABLE OF RECORD IN/OUT
FUNCTION GET_PERSISTENT_CONN_COUNT RETURNS BINARY_INTEGER
PROCEDURE GET_PERSISTENT_CONN_SUPPORT
Argument Name Type In/Out Default?
ENABLE BOOLEAN OUT
MAX_CONNS BINARY_INTEGER OUT
PROCEDURE GET_PROXY
Argument Name Type In/Out Default?
PROXY VARCHAR2 OUT
NO_PROXY_DOMAINS VARCHAR2 OUT
FUNCTION GET_RESPONSE RETURNS RECORD
Argument Name Type In/Out Default?
STATUS_CODE BINARY_INTEGER OUT
REASON_PHRASE VARCHAR2(256) OUT
HTTP_VERSION VARCHAR2(64) OUT
PRIVATE_HNDL BINARY_INTEGER OUT
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
RETURN_INFO_RESPONSE BOOLEAN IN DEFAULT
PROCEDURE GET_RESPONSE_ERROR_CHECK
Argument Name Type In/Out Default?
ENABLE BOOLEAN OUT
PROCEDURE GET_TRANSFER_TIMEOUT
Argument Name Type In/Out Default?
TIMEOUT BINARY_INTEGER OUT
PROCEDURE READ_LINE
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
DATA VARCHAR2 OUT
REMOVE_CRLF BOOLEAN IN DEFAULT
PROCEDURE READ_RAW
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
DATA RAW OUT
LEN BINARY_INTEGER IN DEFAULT
PROCEDURE READ_TEXT
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
DATA VARCHAR2 OUT
LEN BINARY_INTEGER IN DEFAULT
FUNCTION REQUEST RETURNS VARCHAR2
Argument Name Type In/Out Default?
URL VARCHAR2 IN
PROXY VARCHAR2 IN DEFAULT
WALLET_PATH VARCHAR2 IN DEFAULT
WALLET_PASSWORD VARCHAR2 IN DEFAULT
FUNCTION REQUEST_PIECES RETURNS TABLE OF VARCHAR2(2000)
Argument Name Type In/Out Default?
URL VARCHAR2 IN
MAX_PIECES BINARY_INTEGER IN DEFAULT
PROXY VARCHAR2 IN DEFAULT
WALLET_PATH VARCHAR2 IN DEFAULT
WALLET_PASSWORD VARCHAR2 IN DEFAULT
PROCEDURE SET_AUTHENTICATION
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
USERNAME VARCHAR2 IN
PASSWORD VARCHAR2 IN DEFAULT
SCHEME VARCHAR2 IN DEFAULT
FOR_PROXY BOOLEAN IN DEFAULT
PROCEDURE SET_BODY_CHARSET
Argument Name Type In/Out Default?
CHARSET VARCHAR2 IN DEFAULT
PROCEDURE SET_BODY_CHARSET
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
CHARSET VARCHAR2 IN DEFAULT
PROCEDURE SET_BODY_CHARSET
Argument Name Type In/Out Default?
R RECORD IN/OUT
STATUS_CODE BINARY_INTEGER IN/OUT
REASON_PHRASE VARCHAR2(256) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
CHARSET VARCHAR2 IN DEFAULT
PROCEDURE SET_COOKIE_SUPPORT
Argument Name Type In/Out Default?
ENABLE BOOLEAN IN
MAX_COOKIES BINARY_INTEGER IN DEFAULT
MAX_COOKIES_PER_SITE BINARY_INTEGER IN DEFAULT
PROCEDURE SET_COOKIE_SUPPORT
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
ENABLE BOOLEAN IN DEFAULT
PROCEDURE SET_DETAILED_EXCP_SUPPORT
Argument Name Type In/Out Default?
ENABLE BOOLEAN IN DEFAULT
PROCEDURE SET_FOLLOW_REDIRECT
Argument Name Type In/Out Default?
MAX_REDIRECTS BINARY_INTEGER IN DEFAULT
PROCEDURE SET_FOLLOW_REDIRECT
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
MAX_REDIRECTS BINARY_INTEGER IN DEFAULT
PROCEDURE SET_HEADER
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
NAME VARCHAR2 IN
VALUE VARCHAR2 IN DEFAULT
PROCEDURE SET_PERSISTENT_CONN_SUPPORT
Argument Name Type In/Out Default?
ENABLE BOOLEAN IN
MAX_CONNS BINARY_INTEGER IN DEFAULT
PROCEDURE SET_PERSISTENT_CONN_SUPPORT
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
ENABLE BOOLEAN IN DEFAULT
PROCEDURE SET_PROXY
Argument Name Type In/Out Default?
PROXY VARCHAR2 IN
NO_PROXY_DOMAINS VARCHAR2 IN DEFAULT
PROCEDURE SET_RESPONSE_ERROR_CHECK
Argument Name Type In/Out Default?
ENABLE BOOLEAN IN DEFAULT
PROCEDURE SET_TRANSFER_TIMEOUT
Argument Name Type In/Out Default?
TIMEOUT BINARY_INTEGER IN DEFAULT
PROCEDURE SET_TRANSFER_TIMEOUT
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
TIMEOUT BINARY_INTEGER IN DEFAULT
PROCEDURE SET_WALLET
Argument Name Type In/Out Default?
PATH VARCHAR2 IN
PASSWORD VARCHAR2 IN DEFAULT
PROCEDURE WRITE_LINE
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
DATA VARCHAR2 IN
PROCEDURE WRITE_RAW
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
DATA RAW IN
PROCEDURE WRITE_TEXT
Argument Name Type In/Out Default?
R RECORD IN/OUT
URL VARCHAR2(32767) IN/OUT
METHOD VARCHAR2(64) IN/OUT
HTTP_VERSION VARCHAR2(64) IN/OUT
PRIVATE_HNDL BINARY_INTEGER IN/OUT
DATA VARCHAR2 IN -
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
Maybe you are looking for
-
Power Mac G5 stuck on grey screen after swapping machine
Greetings Friends, I have changed my two HD out of one casing to another casing. Both HD worked fine, Both machines worked fine. I have booted up the computer and now the computer sits on the Grey apple logo, with no loading wheel. After 2 mins, the
-
Access SAP through SAPRouter from outside of Network
Hello All, As my SAPRouter cerificate got expired i genrated new certificate & import same into SAProuter. And this time my router is working fine. But this time i want to access from outside of network so added this entries in my SAProutab as follo
-
BexAnalyser : compatibilty of WB created in Excel 2010 with Excel 2003
Hi all, I'm trying to define the compatibilty of worbook created with BexAnalyser (Excel) 2003 with BexAnalyser 2010. When a workbook is created in 2003 version and saved with 2010 version and opened with BexAnalyser 2003, I'm loosing the textelemen
-
TS2446 I do not have another cc to make payments please advise
I am studying and have had my apple ID disabled....To reset to purchase books I need to place another cc...this is day 2 now...it's Sunday and I do not want another cc !!! How frustrating is this !!!!!!
-
How to default value on bet01 based on ansal
Dear Freinds i would like to know how to default the value for bet01 based on the calculated on ansal i want is q0008-bet01 = p0008-ansal /100. Can i default the value using the user exit ZXPADU01 or ZXPADU02. . As my ueser exit is not tr