1

I want to write an insert SQL query to insert Binary base64 data into MongoDB through Simba JDBC driver. I am able to do that through MongoDB Compass tool, but through SQL insert query, I'm not able to proceed. In my Java code I have tried to write code to execute a query like this:

query = insert into table1 (_id,item,defectiveItemCount,mf_date,double_xyz,int32_xyz,status,decimalCol,binCol)  values ('5b3c70e8fcae8df3b58a8d18','lamp',18,'1970-01-01 00:00:00.0',15.0,16.0,1,7.0,BinData(0,"YWJj")) 

But exception is coming like:

[[Simba]JSQLEngine Invalid scalar function or procedure name: BinData.

Appreciate help.

Lauren Rutledge
  • 1,195
  • 5
  • 18
  • 27
Nishant
  • 53
  • 5
  • May I humbly ask out of interest: what advantage does one get using a JDBC driver with a SQL emulation layer for a document oriented database? Imho, this takes out pretty much every advantage MongoDB offers for a rather poor SQL behaviour. If you want SQL with failover capabilies, you might rather have a deeper look into CockroachDB. – Markus W Mahlberg Aug 13 '18 at 19:07
  • @MarkusWMahlberg : This Simba jdbc driver for mongodb is useful for such end users who are familiar with executing SQL queries rather than executing mongodb commands. – Nishant Aug 13 '18 at 20:22
  • Then why not use an RDBMS the first place? One ofbThe advantages of MongoDB is that you do not need to construct your queries around your entity classes to get your questions answered, but instead you model your data so that your questions get answered most efficiently. To paraphrase Rob Pike a bit (may he forgive me): A little bit of redundancy is better than the tiniest bit of `$lookup`... – Markus W Mahlberg Aug 13 '18 at 23:47

0 Answers0