Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Thursday, March 26, 2015

JDBC URL to connect RAC database or How add multiple hosts in jdbc url

Today I will share new problem which I have solved.

In my last project I was connected to Oracle database (RAC) database using multiple hosts and I want to share oracle connection string which uses multiple hosts.

So while you are connecting from oracle clients (as PL/SQL developer) it is easy to define multiple hosts in tnsnames.ora




Thursday, July 18, 2013

SOLVED: Unknown type '246 in column 2 of 3 in binary-encoded result set


Today at our firm was problem like as "Unknown type '246 in column 2 of 3 in binary-encoded result set" when selected table has column as decimal(10, 2) type. This errors cause because we use old version of mysql jdbc driver. Solution for this problem is:
  1. Download new version of driver
  2. Convert double column to char on selection.
    SELECT CAST(your_column AS char(15)) your_column FROM your_table;
    So in this case on java side u can get it as Double again.

Wednesday, February 29, 2012

Connect to Remote database through SSH using Port Forwarding with Java

Yesterday I need connect connect our remote MySQL database that was setup on SSH enabled server and query database. Since it was on SSH enabled server, we can’t connect it directly using JDBC connection API.To achieve this, we first need to create SSH session and then using Port Forwarding we can forward the request to server and connect to database. I used JSchJSch is a pure Java implementation of SSH2.

Friday, November 18, 2011

How to recover mysql db from .myd, .myi, .frm files

One thing to note:
The .FRM file: Regardless of the storage engine you choose, every MySQL table you create is represented, on disk, by a .frm file, which describes the table's format (i.e. the table definition). The file bears the same name as the table, with a .frm extension. MySQL stores .frm files in datadir/database_name (If u don't know where is located your datadir then see your <mysql_install_dir>/my.ini file's #Path to the database root) .frm file is specific to your MySQL version.
The .MYD file is NOT specific to version, at least not minor versions.
The .MYI file is specific, but can be left out and regenerated with REPAIR TABLE.
Recover MySQL DB:
1. Create a dummy database (say vmdb)
2. Copy all these .myd, .myi, .frm files to mysql\data\abc wherein mysql\data\ is the place where .myd, .myi, .frm for all databases are stored.
3. Then go to phpMyadmin, go to db vmdb and you find your database!