MexiCode Ideas en codigo

Eclipse DPT JDBC Drivers

Posted on February 22, 2010

I just installed eclipse-dpt for my database access (works great, btw).

But I needed some JDBC "drivers" for my SQL Engines (namely MySQL and MS SQL). So, to save you the burden of looking for the files all over the internet, here it is, in a single zip file

JDBC Drivers for MySQL and MSSQ

The zip contains 3 jar files:

  • mysql-connector-java-5.1.12-bin.jar - For MySQL v5.1 or lower
  • sqljdbc.jar - MS SQL versions 2005 and 2000
  • sqljdbc4.jar - This works only for MS SQL 2008

Just uncompress the file into some folder, and add the appropiate drivers from eclipse dpt and you're done!

Update: This listing includes links to JDBC drivers for all major database engines.

Filed under: Uncategorized No Comments

Ubuntu Quirks (ongoing…)

Posted on February 21, 2010

Windows Key not detected

If your "Windows Key" (Super_L) is not detected, you will have to run this command:

xmodmap -e "remove mod4 = Super_L"

It seems to work even after rebooting the machine

Can't install Eclipse plugins

In order to install eclipse plugins, after installing eclipse-platform, you *must* install the eclipse-pde package (which comes with the eclipse-jdt as a dependency, oh well...)


This is an ongoing effort to write the odd things I have to do to get my OS to behave as I want.

Filed under: Uncategorized No Comments

Read IMAP Emails with PHP

Posted on February 20, 2010

Well, at work we are all about google app for your domain, we use it for virtually anything. So, we started a new project, in which we had to read emails from our web application, and I remembered reading something about php_imap somewhere, so I decided to check it out.

Lucky as I always am, our hosting provider already had this module installed and working, so I didn“t have to go thru any extra steps, just right on programming.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Open pop mailbox
if (!$mbox = imap_open ("{imap.gmail.com:993/ssl/novalidate-cert}", "mail@googledomain.com", "password"))
{
    die ('Cannot connect/check pop mail! Exiting');
}
 
if ($hdr = imap_check($mbox))
{
    $msgCount = $hdr->Nmsgs;
}
else
{
    die("Failed to get mail");
}
 
//Read $msgCount from INBOX
$MN = $msgCount;
$emails = imap_fetch_overview($mbox,"1:$MN",0);
 
//print email information and delete each email
foreach($emails as $email)
{
    echo "<pre>";
    echo "TO : {$email->to}<br />";
    $file = extract_attachments($mbox, $email->msgno);
    print_r($file);
    echo "</pre>";
    imap_delete($mbox, $email->msgno);
}
 
//delete emails marked for deletion and close connection
imap_expunge($mbox);
imap_close($mbox);

Well, thats shows how to connect to a google domain. I'll talk about the "extract_attachments" function in another post, I'm pretty tired right now.

You should really check the PHP imap function list. There is some really cool stuff going on in there.

NOTE TO SELF the novalidate-cert bit on the connection string to the imap inbox, saves you from quite a few headaches

Tagged as: , No Comments

MySQL search engine (MATCH … AGAINST)

Posted on February 20, 2010

I was writing a full fledged tutorial on performing searches using MySQL, but I think is best if you just look directly into the documentation:

Full-Text Search Functions

Man, there is some serious voodoo shit going on in there.

Tagged as: , No Comments

Remote connection to SQL Server Express 2008

Posted on February 4, 2010

I don't know why SQL Server Express doesn't have remote access "out-of-the-box" but anyways... here is how to enable it.

In the server:

  1. Open SQL Server Configuration Manager
  2. Under SQL Server Network Configuration, select Protocols for SQLEXPRESS and make sure TCP/IP is enabled. Otherwise, enable it
  3. Then, select SQL Server Services, and make sure SQL Server Browser is on Start Mode: Automatic

We need to be sure, that our server accepts SQL Authentication. If you know this option is already enabled in your server, skip the next steps. If you know they are not, or you're not sure, follow this steps:

  1. Open Management Studio (in the server) and connect to your database, using Windows Authentication Mode
  2. Right click on your database, and select Properties
  3. Under Security, select SQL Server and Windows Authentication mode
  4. Under Connections, check "Allow connections to this server"

I read somewhere that you should reboot the server. Just restarting the SQL Server Service doesn't work (I can confirm this).

Now, just remember ALWAYS to add the SQLEXPRESS part to your hostname. For instance, if your server name is win2008server, then you should connect to win2008server\sqlexpress in your applications.