Re: Is there a way to load non-native Date type with LOAD DATA

2006-09-03 Thread Brad Jahnke
 I have a pretty large file with a Date column in the format M/D/.
 
 Is there a way to either change the Date data type in the table or a method
 to indicate the date format in the LOAD DATA statement in order to handle
 this?

If you are using MySQL 5.0.3 or greater, you should be able to transform
your existing string date datq as you use LOAD DATA statement...

Read up on the syntax for utilizing column lists, user variables and a SET
clause in conjunction with LOAD DATA ---
http://dev.mysql.com/doc/refman/5.0/en/load-data.html


Then the you can use the SET clause to transform your existing string date
data into MySQL's date type using the STR_TO_DATE(str,format) function ---
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html


Basically what you will need to do is specify the column list in your LOAD
DATA statement but for your string date data you will want to substitute a
user variable, then include that user variable in your SET clause inside the
STR_TO_DATE function with the relevant format.


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



Re: Joining result sets into 1 row

2006-08-14 Thread Brad Jahnke
 I want to have the rows returned as one row
 Such as 
 ROW 1 Mechanic, Carpenter, Plumber

You may want to try GROUP_CONCAT(expr)  ...

http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html


 


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



Re: stuck on localhost authentication

2006-08-05 Thread Brad Jahnke
   insert into user (user,host) values ('jeff','localhost');
   flush privileges;
   grant all on databaseName.* to jeff;

jeff = [EMAIL PROTECTED]

not [EMAIL PROTECTED]

So in your statement you should have used...

grant all on databaseName.* to [EMAIL PROTECTED];

select user,host from user; returns
 jeff  localhost
 
 In Java, I use:
DriverManager.getConnection( /localhost/databaseName , 'jeff',null );
 
 when the application tries to connect, DriverManager.getConnection() gets a
 bad handshake error.
 
 So I set the password in mysql with:
  set password for jeff = password('xyz');

Similarly... you need to use [EMAIL PROTECTED]

 now select user,host, password from user; returns 2 rows
 jeff localhost
 jeff %  *4232432323
 
 I think this is the problem - the following getConnection() method is
 directed to the 2nd entry because it has a password, but it's not localhost
 so my localhost-based Java app is denied.

 In Java, I use:
 DriverManager.getConnection( /localhost/tm , 'jeff','xyz' );
 
 Then I get an authentication failed error.

Connector/J on 'nix types, only works via TCP/IP.  Your app may be trying to
connect via unix socket.  If the user/password fix does not work specify
127.0.0.1 in your connection setting (or even omit host since 127.0.0.1 is
default host value).  Also, make sure your MySQL server is listening via
TCP/IP.  If it is not, be sure to take the necessary security precautions
before doing so, and/or just enable TCP/IP on 127.0.0.1 (the  user
[EMAIL PROTECTED] is valid for connections on 127.0.0.1).





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



Re: Backup questions

2006-07-03 Thread Brad Jahnke
 2) sometimes, I like to copy just a single table or so out of the backup
 file, and restore just that.

You might want to try out MySQL Administrator which can often be used to
restore backups from mysqldump.  It can _selectively_ restore tables from a
backup file.

http://dev.mysql.com/doc/administrator/en/mysql-administrator-restore.html


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