jdbc question regarding enum

2006-11-01 Thread Jon Drukman
disclaimer: i know nothing about java or jdbc.  a co-worker is trying to 
access a database i've set up using jdbc.  he says that my enum column 
is always returning an integer value instead of the string.  obviously 
this is less than desirable.


does anybody have any advice i could give him on where to look or 
something to change?


-jsd-


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: JDBC Question [Using Multiple databases]

2003-03-19 Thread Mark Matthews
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Mark C. Roduner, Jr. wrote:
Scenario:
	The current JDBC Connection is
	
jdbc:mysql//localhost:3306/=xql?user=root&password=myrootpass
	The database `xql` contains 1 table, `settings`
	Another database, `login` contains 1 table, `users`
	'm' is a Matcher Object, that contains the users Name in $1, and
Domain in $2
Code: 

13)	String sqlString = "";
14)	sqlString += "SELECT * FROM `users` WHERE `user`='" +
m.group(1);
15)	sqlString += "' AND `domain`='" + m.group(2)+"' AND
`pass`=PASSWORD(" + password + ")";
16)	ResultSet logins =
rootConnection.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY).executeQuery(sqlString);


Error Message:
General error,  message from server: "Table 'xqlServer.users'
doesn't exist"
java.sql.SQLException: General error,  message from server:
"Table 'xqlServer.users' doesn't exist"
at
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1628)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
at
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:917)
at
com.mysql.jdbc.Connection.execSQL(Connection.java:1806)
at
com.mysql.jdbc.Connection.execSQL(Connection.java:1740)
at
com.mysql.jdbc.Statement.executeQuery(Statement.java:1220)
at LoginDaemon.LoginUser(LoginDaemon.java:16)
at XQLServer.authLoop(XQLServer.java:103)
at XQLServer.run(XQLServer.java:121)
at java.lang.Thread.run(Unknown Source)
Question:
Seeing that my method obviously fails, is there any way to make
the MySQL JDBC driver allow SQL queries to use a database other than
the current one? (Other than using 'USE [DATABASE]')
Any tips or workarounds would be greatly appreciated.

Thank you in Advance: Mark C. Roduner, Jr. ([EMAIL PROTECTED])
Sure, just fully specify the table name using databasename.tablename.

	-Mark

- -- 
MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

__  ___ ___   __
   /  |/  /_ __/ __/ __ \/ /  Mark Matthews <[EMAIL PROTECTED]>
  / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
 /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE+eR0VtvXNTca6JD8RAkDZAJsF/DTuud76edmiwi1GmJA/jF9L7gCfcgcb
JVG/iB02RMhFVbj+cTFEoN8=
=8OjB
-END PGP SIGNATURE-
-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


JDBC Question [Using Multiple databases]

2003-03-19 Thread Mark C. Roduner, Jr.
Scenario:
The current JDBC Connection is

jdbc:mysql//localhost:3306/=xql?user=root&password=myrootpass
The database `xql` contains 1 table, `settings`
Another database, `login` contains 1 table, `users`
'm' is a Matcher Object, that contains the users Name in $1, and
Domain in $2
Code: 

13) String sqlString = "";
14) sqlString += "SELECT * FROM `users` WHERE `user`='" +
m.group(1);
15) sqlString += "' AND `domain`='" + m.group(2)+"' AND
`pass`=PASSWORD(" + password + ")";
16) ResultSet logins =
rootConnection.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY).executeQuery(sqlString);


Error Message:
General error,  message from server: "Table 'xqlServer.users'
doesn't exist"
java.sql.SQLException: General error,  message from server:
"Table 'xqlServer.users' doesn't exist"
at
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1628)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
at
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:917)
at
com.mysql.jdbc.Connection.execSQL(Connection.java:1806)
at
com.mysql.jdbc.Connection.execSQL(Connection.java:1740)
at
com.mysql.jdbc.Statement.executeQuery(Statement.java:1220)
at LoginDaemon.LoginUser(LoginDaemon.java:16)
at XQLServer.authLoop(XQLServer.java:103)
at XQLServer.run(XQLServer.java:121)
at java.lang.Thread.run(Unknown Source)
Question:
Seeing that my method obviously fails, is there any way to make
the MySQL JDBC driver allow SQL queries to use a database other than
the current one? (Other than using 'USE [DATABASE]')

Any tips or workarounds would be greatly appreciated.

Thank you in Advance: Mark C. Roduner, Jr. ([EMAIL PROTECTED])


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



RE: Simple JDBC Question

2001-11-08 Thread Venu

Hi Michael, 


> -Original Message-
> From: Michael Bitzko [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 5:57 PM
> To: [EMAIL PROTECTED]
> Subject: Simple JDBC Question
> 
> 
>  Please forgive the simplicity of the question, but I'm having
> trouble reading between the lines regarding the JDBC interface.I
> have the following simple code, which load the bridge driver, and then
> attempts to connect to the driver.  The system can't make the
> connection.  My question is the address section of the url.   Where
> would it be looking for a database "my-dsn", and if I have mySql located
> in the "C:" drive, what would the syntax appear like?
> 
> 
> Thanks for your help
> Mike Bitzko
> 
> 
> public static void initialize() {
>   String query = "SELECT * FROM emp";
>   String url   = "jdbc:odbc:my-dsn";
>   try {
>   // Load the jdbc-odbc bridge driver
>   Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
>   System.out.println(".. Loading of the system driver completed"
> );
>   DriverManager.setLogStream(System.out);
> 
>   // Attempt to connect to a driver.  Each one
>   // of the registered drivers will be loaded until
>   // one is found that can process this URL
> 
>   System.out.println(".. Attempt to connect to a driver" );
>   Connection con = DriverManager.getConnection (url, "my-user",
> "my-passwd");
>   System.out.println(".. Attempt to connect is successful" );
>   checkForWarning (con.getWarnings ());
> 
> 
> 
> 
> ===
> \jdk1.3.1_01\bin\javaw -classpath
> "D:\IntroitSys\untitled1\classes;E:\JBuilder4\lib\jbcl.jar;E:\JBuilde
> r4\lib\dx.jar;E:\JBuilder4\lib\beandt.jar;D:\jdk1.3.1_01\demo\jfc\Jav
> a2D\Java2Demo.jar;D:\jdk1.3.1_01\jre\lib\i18n.jar;D:\jdk1.3.1_01\jre\
> lib\jaws.jar;D:\jdk1.3.1_01\jre\lib\rt.jar;D:\jdk1.3.1_01\jre\lib\sun
> rsasign.jar;D:\jdk1.3.1_01\lib\dt.jar;D:\jdk1.3.1_01\lib\htmlconverte
> r.jar;D:\jdk1.3.1_01\lib\tools.jar"
> untitled1.Application1
> .. Loading of the system driver completed
> .. Attempt to connect to a driver
> DriverManager.getConnection("jdbc:odbc:my-dsn")
> trying
> driver[className=sun.jdbc.odbc.JdbcOdbcDriver,sun.jdbc.odbc.JdbcOdbcD
> river@4a8cd1]
> 
> *Driver.connect (jdbc:odbc:my-dsn)
> JDBC to ODBC Bridge: Checking security
> No SecurityManager present, assuming trusted application/applet
> JDBC to ODBC Bridge 2.0001
> Current Date/Time: Thu Nov 08 17:46:05 PST 2001
> Loading JdbcOdbc library
> Allocating Environment handle (SQLAllocEnv)
> hEnv=166007376
> Allocating Connection handle (SQLAllocConnect)
> hDbc=166007544
> Connecting (SQLDriverConnect), hDbc=166007544,
> szConnStrIn=DSN=my-dsn;UID=my-user;PWD=my-passwd
> RETCODE = -1
> ERROR - Generating SQLException...
> Closing connection (SQLFreeConnect), hDbc=166007544
> Closing environment (SQLFreeEnv), hEnv=166007376
> getConnection failed: java.sql.SQLException: [Microsoft][ODBC Driver
> Manager] Data source name not found and no default driver specified
> 
> *** SQLException caught ***
> 
> SQLState: IM002
> Message:  [Microsoft][ODBC Driver Manager] Data source name not found
> and no default driver specified
> Vendor:
> 

The above error says, you didn't configured the MyODBC DSN 
'my-dsn'. When you are using JdbcOdbc Bridge driver inorder to 
access MySQL through JAVA applications through MyODBC driver, 
you need to define MyODBC DSN also. So, first define this, and 
then try connecting, and hopefully it will.

For more information about MyODBC, refer to its online 
manual at www.mysql.com/doc (section 8.3)

Regards, venu
-- 
For technical support contracts, go to https://order.mysql.com
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /  Mr. Venu <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer
/_/  /_/\_, /___/\___\_\___/ California, USA
   <___/ www.mysql.com



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Simple JDBC Question

2001-11-08 Thread Michael Bitzko

 Please forgive the simplicity of the question, but I'm having
trouble reading between the lines regarding the JDBC interface.I
have the following simple code, which load the bridge driver, and then
attempts to connect to the driver.  The system can't make the
connection.  My question is the address section of the url.   Where
would it be looking for a database "my-dsn", and if I have mySql located
in the "C:" drive, what would the syntax appear like?


Thanks for your help
Mike Bitzko


public static void initialize() {
  String query = "SELECT * FROM emp";
  String url   = "jdbc:odbc:my-dsn";
  try {
  // Load the jdbc-odbc bridge driver
  Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
  System.out.println(".. Loading of the system driver completed"
);
  DriverManager.setLogStream(System.out);

  // Attempt to connect to a driver.  Each one
  // of the registered drivers will be loaded until
  // one is found that can process this URL

  System.out.println(".. Attempt to connect to a driver" );
  Connection con = DriverManager.getConnection (url, "my-user",
"my-passwd");
  System.out.println(".. Attempt to connect is successful" );
  checkForWarning (con.getWarnings ());




===
\jdk1.3.1_01\bin\javaw -classpath
"D:\IntroitSys\untitled1\classes;E:\JBuilder4\lib\jbcl.jar;E:\JBuilder4\lib\dx.jar;E:\JBuilder4\lib\beandt.jar;D:\jdk1.3.1_01\demo\jfc\Java2D\Java2Demo.jar;D:\jdk1.3.1_01\jre\lib\i18n.jar;D:\jdk1.3.1_01\jre\lib\jaws.jar;D:\jdk1.3.1_01\jre\lib\rt.jar;D:\jdk1.3.1_01\jre\lib\sunrsasign.jar;D:\jdk1.3.1_01\lib\dt.jar;D:\jdk1.3.1_01\lib\htmlconverter.jar;D:\jdk1.3.1_01\lib\tools.jar"
untitled1.Application1
.. Loading of the system driver completed
.. Attempt to connect to a driver
DriverManager.getConnection("jdbc:odbc:my-dsn")
trying
driver[className=sun.jdbc.odbc.JdbcOdbcDriver,sun.jdbc.odbc.JdbcOdbcDriver@4a8cd1]

*Driver.connect (jdbc:odbc:my-dsn)
JDBC to ODBC Bridge: Checking security
No SecurityManager present, assuming trusted application/applet
JDBC to ODBC Bridge 2.0001
Current Date/Time: Thu Nov 08 17:46:05 PST 2001
Loading JdbcOdbc library
Allocating Environment handle (SQLAllocEnv)
hEnv=166007376
Allocating Connection handle (SQLAllocConnect)
hDbc=166007544
Connecting (SQLDriverConnect), hDbc=166007544,
szConnStrIn=DSN=my-dsn;UID=my-user;PWD=my-passwd
RETCODE = -1
ERROR - Generating SQLException...
Closing connection (SQLFreeConnect), hDbc=166007544
Closing environment (SQLFreeEnv), hEnv=166007376
getConnection failed: java.sql.SQLException: [Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified

*** SQLException caught ***

SQLState: IM002
Message:  [Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified
Vendor:




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: JDBC question

2001-02-16 Thread William R. Mussatto


Don't work with oracle.  Sorry.  However did have a problem with the 
version of the jdbc driver on the mysql web site but not with the one on 
developer's site.  It was for mysql not oracle.  

On Fri, 16 Feb 2001, webmaster wrote:

> Date: Fri, 16 Feb 2001 15:44:11 -0500 (EST)
> From: webmaster <[EMAIL PROTECTED]>
> To: "William R. Mussatto" <[EMAIL PROTECTED]>
> Cc: Chen Ka Pong <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: JDBC question
> 
> I am , well I will have to wioork with oracle and jdeveloper, can some of 
> you please please please telll me where canI find examples of conections 
> to a database an oracle databse and if I use php again eh the 
> same question where can I see examples of conections to an oralce data 
> base using php...  information about jdeveloper... and oracle , perhaps a 
> user group, a mailling list... is jdeveloper hard to use? are jdevelopers 
> graphical interfaces easy to understand? I am not a java programmer so I 
> must ask how easy may jdeveloper be I only need to stablish conectivity 
> to an oracle database, buid the interfaces for consulting the data base 
> and adding datas to it... well thanks a lot inadvance, cheers 
> 
> On Fri, 16 Feb 2001, William R. Mussatto wrote:
> 
> > Date: Fri, 16 Feb 2001 10:48:57 -0800 (PST)
> > From: William R. Mussatto <[EMAIL PROTECTED]>
> > To: Chen Ka Pong <[EMAIL PROTECTED]>
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: JDBC question?
> > 
> > 
> > Had similar problem, get the current version of the driver.
> > 
> > On Fri, 16 Feb 2001, Chen Ka Pong wrote:
> > 
> > > Date: Fri, 16 Feb 2001 20:29:27 +0800
> > > From: Chen Ka Pong <[EMAIL PROTECTED]>
> > > To: [EMAIL PROTECTED]
> > > Subject: JDBC question?
> > > 
> > > I cannot use the jdbc connection which the driver is download
> > > from mysql web site. The error message prompted that
> > > "invalid JDBC Driver", what can cause this error?
> > > I predict my classpath is wrong, but I would like to know
> > > how to set the classpath?
> > > (at this status, I am not sure if my classpath is correct or not)
> > > 
> > > Thanks!
> > > 
> > > Pong
> > > 
> > 
> > Sincerely,
> > 
> > William Mussatto, Senior Systems Engineer
> > CyberStrategies, Inc
> > ph. 909-920-9154 ext. 27
> > 
> > 
> > -
> > Before posting, please check:
> >http://www.mysql.com/manual.php   (the manual)
> >http://lists.mysql.com/   (the list archive)
> > 
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> > 
> > 
> 

Sincerely,

William Mussatto, Senior Systems Engineer
CyberStrategies, Inc
ph. 909-920-9154 ext. 27


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




JDBC question

2001-02-16 Thread webmaster

I am , well I will have to wioork with oracle and jdeveloper, can some of 
you please please please telll me where canI find examples of conections 
to a database an oracle databse and if I use php again eh the 
same question where can I see examples of conections to an oralce data 
base using php...  information about jdeveloper... and oracle , perhaps a 
user group, a mailling list... is jdeveloper hard to use? are jdevelopers 
graphical interfaces easy to understand? I am not a java programmer so I 
must ask how easy may jdeveloper be I only need to stablish conectivity 
to an oracle database, buid the interfaces for consulting the data base 
and adding datas to it... well thanks a lot inadvance, cheers 

On Fri, 16 Feb 2001, William R. Mussatto wrote:

> Date: Fri, 16 Feb 2001 10:48:57 -0800 (PST)
> From: William R. Mussatto <[EMAIL PROTECTED]>
> To: Chen Ka Pong <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: JDBC question?
> 
> 
> Had similar problem, get the current version of the driver.
> 
> On Fri, 16 Feb 2001, Chen Ka Pong wrote:
> 
> > Date: Fri, 16 Feb 2001 20:29:27 +0800
> > From: Chen Ka Pong <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Subject: JDBC question?
> > 
> > I cannot use the jdbc connection which the driver is download
> > from mysql web site. The error message prompted that
> > "invalid JDBC Driver", what can cause this error?
> > I predict my classpath is wrong, but I would like to know
> > how to set the classpath?
> > (at this status, I am not sure if my classpath is correct or not)
> > 
> > Thanks!
> > 
> > Pong
> > 
> 
> Sincerely,
> 
> William Mussatto, Senior Systems Engineer
> CyberStrategies, Inc
> ph. 909-920-9154 ext. 27
> 
> 
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: JDBC question?

2001-02-16 Thread William R. Mussatto


Had similar problem, get the current version of the driver.

On Fri, 16 Feb 2001, Chen Ka Pong wrote:

> Date: Fri, 16 Feb 2001 20:29:27 +0800
> From: Chen Ka Pong <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: JDBC question?
> 
> I cannot use the jdbc connection which the driver is download
> from mysql web site. The error message prompted that
> "invalid JDBC Driver", what can cause this error?
> I predict my classpath is wrong, but I would like to know
> how to set the classpath?
> (at this status, I am not sure if my classpath is correct or not)
> 
> Thanks!
> 
> Pong
> 

Sincerely,

William Mussatto, Senior Systems Engineer
CyberStrategies, Inc
ph. 909-920-9154 ext. 27


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: JDBC question?

2001-02-16 Thread Thiru


If U R using some IDE, then there shd be a place to add on Ur classpaths.
If not, from the prompt
For Windows > java -classpath "c:\JDBCdriver;c:\JDBCdriver\driver.jar;." file.java
For Unix> java -classpath "/tmp/JDBCdriver:/tmp/JDBCdriver/driver.jar:." file.java

note: when including jar or zip U have to include the fileName.

Cheers!

Thiru
PS: U find extensiv dos on setting classpath. go to www.javasoft.com

On Fri, 16 Feb 2001 20:29:27 +0800
Chen Ka Pong <[EMAIL PROTECTED]> wrote:

-> I cannot use the jdbc connection which the driver is download
-> from mysql web site. The error message prompted that
-> "invalid JDBC Driver", what can cause this error?
-> I predict my classpath is wrong, but I would like to know
-> how to set the classpath?
-> (at this status, I am not sure if my classpath is correct or not)
-> 
-> Thanks!
-> 
-> Pong
-> 

-o0o
  "There is no finish line, you can always learn" 
 "You have to keep pressure on yourself,  you have to work on your weaknesses". 

Thiru
S/W Engineer, Service Dvlpment Group
Infoseek,Japan  Voice - (81)-3-5453-2056
http://www.infoseek.co.jp <- Click Here
http://www.rakuten.co.jp <- Click Here
http://house.infoseek.co.jp  <- Click Here
http://profile.infoseek.co.jp  <- Click Here
http://chat.infoseek.co.jp  <- Click Here


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




JDBC question?

2001-02-16 Thread Chen Ka Pong

I cannot use the jdbc connection which the driver is download
from mysql web site. The error message prompted that
"invalid JDBC Driver", what can cause this error?
I predict my classpath is wrong, but I would like to know
how to set the classpath?
(at this status, I am not sure if my classpath is correct or not)

Thanks!

Pong