Quantcast
Channel: MySQL Forums - Connector/ODBC
Viewing all 1136 articles
Browse latest View live

Weird Issue : Error while executing SSIS Package to Port data between SQL Server and MySQL (no replies)

$
0
0
I am transferring data from MS SQL Server 2008 to MySQL using SSIS Package. I have done mapping of all the tables. But while executing the package I am getting error - Unable to cast object of type 'System.DateTime' to type 'System.Char[]'

On verification I found that my source SQL Server table contains 4 varchar columns and 1 datetime column - which is matching with destination MySQL Table.

However, I figured out my datetime column contains a few NULL values. Hence, I have made default NULL in my destination column in MySQL table as well.

When I port a sample data - set of 2 rows with NULL datetime value - it gets ported without any error.

And I tried porting data with a sample data - set of 2 rows without any NULL values in datetime column - obviously it got ported without any errors.

However, when I tried to port the data - sample data with a combination of NULL values and valid datetime values - the package fails with the above error.

So now, I have 2 dataflow tasks - the first dataflow task ports the rows with NULL values and the second dataflow task ports the rows without NULL values from the same source table to the same destination table.

But why it is failing when i port the data in a single dataflow task?

Any expert solution in this matter would be of great help as I have to port more than 40 table data between SQL Server and MySQL on a weekly basis. Hence, creating double dataflow task may not be a good idea.

Reference : My setup is exactly as mentioned in this link - http://dbperf.wordpress.com/2010/07/23/sql-server-integration-services-2008-ssis-and-mysql/

ODBC Connector for AIX ? (no replies)

$
0
0
Hi,
Is there an ODBC Connector available for AIX ? If so, from where can it be downloaded ?

Regards,
Mike

sqlGetInfo returns incorrect string length (no replies)

$
0
0
Hi,

I have application that calls sqlGetInfo to get database name/version from either Unicode or ANSI driver. We rely on the stringlength returned from the driver to get the actual value of returned string.

On Linux i38x, I see MySQL ODBC driver returns incorrect values. If basing on the returned stringlength to get the final value, the the value would be truncated. According to ODBC document, the returned stringlength is used to get the final string value.

Thanks

Son Nguyen

#if defined(WIN32)
#include <windows.h>
#endif
#include "sql.h"
#include "sqlext.h"
#include "sqltypes.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <locale.h>
#include <ctype.h>

#define NUMBER_THREADS 40

#define UDA_MAX_STRING_LENGTH 1024


void print_error(
char * api,
SQLSMALLINT HandleType,
SQLHANDLE Handle
)
{
SQLRETURN rc = SQL_SUCCESS;
SQLCHAR Sqlstate[ SQL_MAX_MESSAGE_LENGTH ];
SQLINTEGER NativeErrorPtr;
SQLCHAR MessageText[ SQL_MAX_MESSAGE_LENGTH ];
SQLSMALLINT BufferLength = sizeof( MessageText );
SQLSMALLINT TextLengthPtr;

int i = 1;
while( SQL_NO_DATA != SQLGetDiagRec (
HandleType,
Handle,
i++,
Sqlstate,
&NativeErrorPtr,
MessageText,
BufferLength,
&TextLengthPtr ) )
{
printf( "api = %s, Error: %s\n", api, MessageText );
}
}

SQLRETURN connect1( SQLHANDLE * henv, SQLHANDLE * hdbc )
{
SQLRETURN rc = SQL_SUCCESS;

rc = SQLAllocHandle ( SQL_HANDLE_ENV, SQL_NULL_HANDLE, henv );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLAllocHandle", SQL_HANDLE_ENV, NULL );
}

rc = SQLSetEnvAttr(*henv, SQL_ATTR_ODBC_VERSION, ( SQLPOINTER )SQL_OV_ODBC3, 0);
if ( rc != SQL_SUCCESS ) {
print_error( "SQLSetEnvAttr", SQL_HANDLE_ENV, *henv );
}

rc = SQLAllocHandle( SQL_HANDLE_DBC, *henv, hdbc );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLAllocHandle", SQL_HANDLE_ENV, *henv );
}

rc = SQLSetConnectAttr ( *hdbc, SQL_LOGIN_TIMEOUT, 0, 0 );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLSetConnectAttr", SQL_HANDLE_DBC, *hdbc );
}

{
SQLHWND WindowHandle = NULL;
SQLCHAR InConnectionString[ 1024 ] = "DSN=GOSALES1_MYSQL_55;UID=gosales1;PWD=gosales1";
SQLSMALLINT StringLength1 = sizeof( InConnectionString );
SQLCHAR OutConnectionString[ 1024 ];
SQLSMALLINT BufferLength = sizeof( OutConnectionString );
SQLSMALLINT StringLength2Ptr;
SQLUSMALLINT DriverCompletion = SQL_DRIVER_COMPLETE;

rc = SQLDriverConnect( *hdbc,
WindowHandle,
InConnectionString,
StringLength1,
OutConnectionString,
BufferLength,
&StringLength2Ptr,
DriverCompletion );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLDriverConnect", SQL_HANDLE_DBC, *hdbc );
}

}

return rc;
}

SQLRETURN disconnect1( SQLHENV henv, SQLHDBC hdbc )
{
SQLRETURN rc = SQL_SUCCESS;

rc = SQLDisconnect( hdbc );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLDisconnect", SQL_HANDLE_DBC, hdbc );
}

rc = SQLFreeHandle( SQL_HANDLE_DBC, hdbc );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLFreeHandle", SQL_HANDLE_DBC, hdbc );
}

rc = SQLFreeHandle( SQL_HANDLE_ENV, henv );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLFreeHandle", SQL_HANDLE_ENV, henv );
}

return rc;
}


SQLRETURN getDatabaseInfo( SQLHENV henv, SQLHDBC hdbc )
{
SQLSMALLINT StringLengthPtr;

SQLRETURN rc = SQL_SUCCESS;

union {
SQLCHAR infoChar [ UDA_MAX_STRING_LENGTH + 4 ];
SQLUINTEGER infoUInteger ;
SQLUSMALLINT infoUSmallInt ;
} infoData;


rc = SQLGetInfo ( hdbc, SQL_DBMS_NAME, infoData.infoChar, sizeof(infoData.infoChar), &StringLengthPtr );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLGetInfo", SQL_HANDLE_DBC, hdbc );
}
printf ("SQL_DBMS_NAME = %s, StringLengthPtr = %d \n", infoData.infoChar, StringLengthPtr );

rc = SQLGetInfo ( hdbc, SQL_DBMS_VER, infoData.infoChar, sizeof(infoData.infoChar), &StringLengthPtr );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLGetInfo", SQL_HANDLE_DBC, hdbc );
}
printf ("SQL_DBMS_VER = %s, StringLengthPtr = %d \n", infoData.infoChar, StringLengthPtr );

rc = SQLGetInfo ( hdbc, SQL_DRIVER_NAME, infoData.infoChar, sizeof(infoData.infoChar), &StringLengthPtr );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLGetInfo", SQL_HANDLE_DBC, hdbc );
}
printf ("SQL_DRIVER_NAME = %s, StringLengthPtr = %d \n", infoData.infoChar, StringLengthPtr );

rc = SQLGetInfo ( hdbc, SQL_DRIVER_VER, infoData.infoChar, sizeof(infoData.infoChar), &StringLengthPtr );
if ( rc != SQL_SUCCESS ) {
print_error( "SQLGetInfo", SQL_HANDLE_DBC, hdbc );
}
printf ("SQL_DRIVER_VER = %s, StringLengthPtr = %d \n", infoData.infoChar, StringLengthPtr );

return rc;
}


void test1( void *dummyPtr ) {
SQLRETURN rc = SQL_SUCCESS;

SQLHENV henv;
SQLHDBC hdbc;

rc = connect1( &henv, &hdbc );
if ( rc != SQL_SUCCESS ) {
printf( "connect() failed \n" );
}

rc = getDatabaseInfo( henv, hdbc );
if ( rc != SQL_SUCCESS ) {
printf( "getDatabaseInfo() failed \n" );
}

rc = disconnect1( henv, hdbc );
if ( rc != SQL_SUCCESS ) {
printf( "disconnect() failed \n" );
}
}


int main(int argc, char *argv[])
{
test1( NULL );
return 0;
}


drv-mob:/uda/dev/nguyens/mysql> ./a.out
SQL_DBMS_NAME = MySQL, StringLengthPtr = 2
SQL_DBMS_VER = 5.5.12, StringLengthPtr = 3
SQL_DRIVER_NAME = libmyodbc5w.so, StringLengthPtr = 7
SQL_DRIVER_VER = 05.02.0003, StringLengthPtr = 5

Set up DSN on User Computer: File DSN Was Not Saved Error?? (no replies)

$
0
0
So it seems like every time I need to install and configure a DSN on a user's computer, it gives me a hard time......

I have tried logging in with administrative credentials, too.

I am trying to add a DSN to the User DSN and File DSN tabs under Control Panel, Administrative Tools, open Data Sources (ODBC).

I click the Add button under the User DSN tab and enter all of the information in the Create New Data Source dialog box, hit the Test button, it says "Connection successful".

I do the same under File DSN tab, says "Connection successful", but when I click OK in the same tab, it says "File DSN was not saved"??

Can anyone help me with this ??

If I open MS Access and try to hit External Tab, ODBC Connections button and then choose Link to option and then click on the File DSN it automatically goes to, it gives me this error:

ODBC -call failed.

[Microsoft][ODBC Driver Manager]Data Source Name not found and no default driver specified (#0)


Can someone please help me with this???

14 KB
ODBC error

Attempted to read or write protected memory in ODBC connector (no replies)

$
0
0
Hi,

I try to connect to MySQL 5.6 server through MySQL ODBC connector 5.2(w) from ADO.NET. I write a simple code in C#.

static void Main(string[] args) {
using (OdbcConnection connection = new OdbcConnection("DSN=MYDSN")){
connection.Open();
DataTable tables = connection.GetSchema("Tables");
DataTable datatypes = connection.GetSchema("DataTypes");
}
}

connection.GetSchema("DataTypes") method throw an exception:
System.AccessViolationException
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Stack Trace

at System.Data.Common.UnsafeNativeMethods.SQLFreeStmt(OdbcStatementHandle StatementHandle, STMT Option)
at System.Data.Odbc.OdbcStatementHandle.FreeStatement(STMT stmt)
at System.Data.Odbc.CMDWrapper.FreeStatementHandle(STMT stmt)
at System.Data.Odbc.OdbcDataReader.Close(Boolean disposing)
at System.Data.Odbc.OdbcDataReader.Dispose(Boolean disposing)
at System.Data.Common.DbDataReader.Dispose()
at System.Data.Odbc.OdbcMetaDataFactory.GetDataTypesCollection(String[] restrictions, OdbcConnection connection)
at System.Data.Odbc.OdbcMetaDataFactory.PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)
at System.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions)
at System.Data.ProviderBase.DbConnectionInternal.GetSchema(DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, String collectionName, String[] restrictions)
at System.Data.Odbc.OdbcConnection.GetSchema(String collectionName, String[] restrictionValues)
at System.Data.Odbc.OdbcConnection.GetSchema(String collectionName)
at ConsoleApplication3.Program.Main(String[] args)

ODBC connector architecture is x86.

Anyone know how to fix this problem?

Thanks!

ODBC driver requirements for connecting to 5.6 server (1 reply)

$
0
0
Hi,

I'm sorry if there is an information about this already on this forum. I wasn't able to find one.
I have a mySQL 5.6.10 CE server running and trying to connect with an ODBC connector 5.1.6 from an IBM p-Series with AIX 6.1. I could connect a 5.1.45 CE server without any problems before.
I did the tests with mysql_client_test, but these fail right after the connect, which was successful. I added the output from mysql_client_test below.
I'm not so experienced with mySQL and trying to get close to the error step by step.

So my first question is: Is it possible to connect with the ODBC 5.1.6 to the 5.6.10 server?

If it is necessary to use a newer ODBC connector version, is someone aware of compiled versions for AIX?

Thanks in advance!

Regards,
Oliver

=======================================================

Output from mysql_client_text (I run the checks as dba. It also creates the client_test_db, but empty):

#####################################
client_connect
#####################################

Establishing a connection to 'xxxxxxxx' ...OK
Connected to MySQL server version: 5.6.10-log (50610)

Creating a test database 'client_test_db' ...mysql_client_test.c:248: check failed: 'row'

Unable to build ODBC connector on Visual Studio 2012 (no replies)

$
0
0
I downloaded the ODBC source from http://dev.mysql.com/downloads/connector/odbc/#downloads

Inside that there is a build.win which says that one needs to install CMake, setup an environment variable and fire up cmake which generates the native makefiles (or .sln file for VS2012).

This doesn't work. The error is

C:\projects\MySQL.Connectors\mysql-connector-odbc-5.2.4-src> cmake -G "Visual Studio 11 Win64"
-- The C compiler identification is MSVC 17.0.51106.1
-- The CXX compiler identification is MSVC 17.0.51106.1
-- Check for working C compiler using: Visual Studio 11 Win64
-- Check for working C compiler using: Visual Studio 11 Win64 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
11.0/VC/bin/x86_amd64/cl.exe" is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/projects/MySQL.Connectors/mysql-connector-odbc-5.2.4-src/CMakeFiles/CMakeTmp

Run Build Command:C:\PROGRA~2\MICROS~1.0\Common7\IDE\devenv.com
CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec3889604268


Question: How does one build the ODBC driver on Windows? I'm aware of the .NET connector - we're targetting the ODBC driver specifically. Thanks

Strange result when using ODBC (no replies)

$
0
0
Hello,

I have a intranetsite running on PHP & Mysql. "Live" I've got 1118 records in my database (PHPmanager).But when I make a connection throught ODBC to do a mailmerge only 1113 records show up. The last 5 do not for some reason...
I presume that there is no some kind of limit when using ODBC ?

This setup is working almost 3 years now and nothing has been changed ?

Perhaps anyone has had this kind of behavior before ?

Any help appreciated !

Stefan

Ever-changing connection string (no replies)

$
0
0
Is there some benefit to constantly changing the connection string to access the ODBC driver?

I am often having to recompile my source code due to the ever-changing nature of the ODBC driver= string. A couple months ago it was suffixed with "CE", then the suffix became "W", now it is "A". As the string also contains the a portion of the version number ("5.2"), it is obvious that the string will never be static. I've now decided to make my programs read an external flat file, and to obtain the driver name from it. I'll then at least be able to avoid the frequent recompiles.

Programmatically ensuring end-users are running the current version is also a little screwy. The file "myodbc5w.dll" is older than "myodbc5a.dll", so the naming convention does not seem to indicate which is the current file. Yet, if I search the install directory using a wildcard for the suffix, in order to check file version numbers, i'll gets hits on both a "myodbc5a.dll" and a "myodbc5S.dll". Granted, they should both return the same version number, but if the core library has a variable suffix, like "myodbc5w.dll" or "myodbc5a.dll", why is there a library with a different purpose following the same naming convention?

Wouldn't it create less confusion to give the setup library a more unique name, rather than making it look like a version of the core library?

Is there a reason not to maintain a more static connection string such as "Driver={MySQL ODBC5 Driver};" and eliminate the need for constant program maintenance?

It's been a long day here, I hope I don't come across as grumpy.
Any replies are greatly appreciated.

architecture mismatch (no replies)

$
0
0
I am receiving this error. All current drivers are installed. It happens on all MS Office products tested (Excel, Word - both 2010 versions).

Thanks all

the specified DSN contains an architecture mismatch between the driver and application

Setting up the data source is successful. Only happens when in the application and trying to add a new source in mailings in Word for example.

ODBC Connector can't connect with Excel - the specified DSN contains an architecture mismatch (no replies)

$
0
0
Scenario:
ODBC Connector 5.2
Excel 2010
Win7 (Ent) 64

I can setup the connector with no problem (tests fine). But when I goto Excel, to connect to other ODBC connections, I get the following message:

the specified DSN contains an architecture mismatch

I have read where I should try the following:

1. Load 32bit version, then overlay with 64bit version (results in a catastrophic error).
2. Use just the 32bit version, the driver isn't even recognized.
3. Tried using the 5.1.9 build, the same initial issue.

This screams a interaction issue with Excel, but I'm at my wits end on what to try next. I'm sure somebody has been successful with this config before. SO if you would be kind enough to share your recipe. I would be most beholding to you.

THanks,
D-

Connecting from an Open Office client (no replies)

$
0
0
In the past, some Open Office database users, when they wanted to go beyond using the embedded engine, tried connecting to MySQL servers with the ODBC connector.

Open Office now has it's own, native, MySQL connector... it is a normal "extension".

For help with getting MySQL (server) and Open Office "Base" (dreadful name!) (client) "playing nicely" together, see....

http://sheepdogguides.com/srv/s0MySqlDoInst.htm

Mac OS X 10.8 ODBC Connector (no replies)

$
0
0
Hello,

I'm trying to establish a connection to an online MySQL database. I have downloaded the latest connector from the web page, configured the DSN as recommended, but still not able to establish a successful connection.

When I take a look at the ODBC connector I don't find any connector for Mac OS X 10.8. The last version of OS X supported seems to be 10.7. Does this connector actually works with 10.8? Did anyone try it?

Is the first time I post here so if you need more information or any log files please tell me and I will provide them asap.

Thanks in advance!

Best Regards,

Rodrigo

Connecting to MySQL using ADO with VBA for Excel (no replies)

$
0
0
I'm having trouble with connecting to MySQL from Excel. I have installed MySQL on a machine and I am using Wokbench as a front-end. I went to the ODBC Data source administrator screen and in the list of drivers it shows the MySQL ODBC 5.2w Driver. Within MySQL, I have a sample schema called sakila.

How do I get a standard connection string to work using an ADODB.Connection on the same machine? I want to first get the connection running on the same machine, and then try connecting to MySQL from Excel on another machine in the network. I have a Uid and Pwd working from Workbench, and the current string I tried is
cn.Open "DRIVER={MySQL ODBC 5.2w Driver};UID=adasgupta;PWD=mypwd;Database=Sakila;"
For the post, I've just replaced the actual password here with mypwd. When I run it, I get an error that says data source name not found and no default driver specified. I've referenced the Activex Data Objects 6.0 library in VBA.

Prepared Statements (no replies)

$
0
0
I am using the 5.2.4 ODBC driver and 5.6. My application uses prepared statements extensively. It caches them and re-executes as needed. What I have found is that the ODBC driver will create a prepared statement and execute it the first time. But subsequent executions will do direct execution of the statement with literals. Why would the ODBC driver not re-execute the prepared statement?

I was looking at this because I found a problem using prepared statements with the C/C++ APIs. Certain SQL with VIEWs cause the server to crash when they are executed more than once. It does not happen when using ODBC. Looks that is because it is only executes a prepared statement once.

Getting data from Access DB to MySQL DB (1 reply)

$
0
0
How can I access tables in Access from MySQL with ODBC.
(I'm NOT searching the other way round, I don't want a table in Access linking to a MySQL table)

Accessing MySQL tables in Access is very easy, so is the other way round also possible?


The data in Access changes daily, so only exporting the tables to MySQL is no option, i need to synchronize the data somehow. Changes in Access need to be transfered also to the MySQL DB.

MySQL/ODBC 5.2.4 crashes with Foxpro 9 Remote Views and CursorAdapters (no replies)

$
0
0
Hi Community,

I tried out the MySQL ODBC client Version 5.2 with a Visual Foxpro 9 based application. Using a CursorAdapter crashes the whole application (no specific error message, just a GPF) on the "cursorfill" method of the CursorAdapter. The same application works fine and stable with MySQL ODBC 5.1 (any version) connecting to the same server. Also SQL-passthrough commands (SQLEXEC) seem to work without problems. I tried out several options including the new "no_ssps"-option without effect.
There must be some behaviour change in the ODBC 5.2 Client that leads to the crash.

Thank you very much for any suggestions!

PS: The Crash occurs with both client Versions 5.2a and 5.2w

Environment:
* MySQL Community Edition 5.6 (tried 5.1,5.5 also) 64Bit
* Windows 7 64Bit
* MySQL ODBC 5.2.4 32Bit
* VFP 9.0 SP1 Build 7423



Kind regards,
Gerold

Can't install ODBC Drivers (no replies)

$
0
0
I have downloaded the SQL ODBC connecter driver for Mac, but can't install it. The error message I get is: "MySQL Connector ODBC 5.2.pkg" can't be opened because it is from an unidentified developer. Your security preferences allow installation of only apps form the Mac App Store and identified developers.

Can anyone tell me how to change my security preferences? I can't seem to find it!

Thanks in advance. Please email me directly and post to this forum.

Linda
-------
Linda@compu-books.com

odbc 5.2a or odbc 5.2w? (no replies)

$
0
0
Can anyone tell me whats the difference between odbc 5.2a or odbc 5.2w and how to make sure a query in excel can run on both? Or of course were to find the info
Thanks

Need ODBC connector on AIX 6.1 that works with DataStage 8.7 and MySQL Community Edition (no replies)

$
0
0
Hi,
As we all know, the ODBC driver supplied by IBM only works with MySQL Enterprise Edition. We visited the MySQL website but couldn't locate a driver for AIX.

Our server admin has procured a customized version, which when used on AIX 6.1 with DataStage 8.7 throws the following error:

DSD.BCIOpenR call to function SQLTables failed.
SQLSTATE=S1004, DBMS.CODE=0
[DataStage][SQL Client]An unsupported SQL data type was encountered

Could someone help us to find the right ODBC connector for MySQL Community Edition that works on AIX and is compatible with DataStage 8.7?

If one doesn't exist, kindly provide us with a step by step guide that will help us to compile from source on AIX 6.1.
Viewing all 1136 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>